Data Science Hour of Code

Activity 6: Separating into Sub-Charts

Scenario:

  • You're a data scientist working with a group of researchers from Antarctica.
  • They have collected a bunch of data about penguins, but need help answering questions about it.
  • Your job is to make some charts from the data and answer some of their questions.

Introduction:

In Activity 4, we made a chart separating our penguins into three groups based on their species. The chart we made had a cluster of data points for each species that didn't overlap, so it was pretty easy to see all the points in each group. Sometimes, the data can look pretty messy when we plot it. For example, if you run the program below, we are separating the penguins into three groups based on the island they live on. You'll notice that we can kind of tell where the Biscoe and Dream groups are on the plot, but the Torgersen group is overlapped and hard to examine. In this case, it can be very useful to split our groups of data into their own Sub-Charts.

Sample of Penguins2.CSV file
speciesislandbill_depthbill_lengthflipper_length
AdelieTorgersen18.739.1181
AdelieBiscoe18.337.8174
AdelieDream18.536.8193
GentooBiscoe13.246.1211
ChinstrapDream17.946.5192

Instructions:

In the code editor below, we have a program that makes a Chart looking at Bill Depth vs Bill Length divided into groups based on Island. Take code blocks from the palette and place them below where we make the Chart object and before we Display the chart.

  1. Before adding anything, try running the program and inspect the Chart.
  2. Stop the program.
  3. Use the block(s) in the palette on the left.
  4. Place the 'chart:SeparateByFactor()' block below the 'ScatterPlot chart = frame:ScatterPlot()' block in the block editor.
  5. Run the program.
  6. Use the chart in the canvas to answer the questions in the Activity section.

Coding:

Blocks

Activity:

Use the chart(s) you've created in the Coding section to answer a few questions.








Next Tutorial

In the next tutorial, we will discuss Trying Other Charts, which describes how to look at data with different Chart types..