Data Science Hour of Code
Activity 6: Separating into Sub-ChartsScenario:
- 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.
species | island | bill_depth | bill_length | flipper_length |
---|---|---|---|---|
Adelie | Torgersen | 18.7 | 39.1 | 181 |
Adelie | Biscoe | 18.3 | 37.8 | 174 |
Adelie | Dream | 18.5 | 36.8 | 193 |
Gentoo | Biscoe | 13.2 | 46.1 | 211 |
Chinstrap | Dream | 17.9 | 46.5 | 192 |
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.
- Before adding anything, try running the program and inspect the Chart.
- Stop the program.
- Use the block(s) in the palette on the left.
- Place the 'chart:SeparateByFactor()' block below the 'ScatterPlot chart = frame:ScatterPlot()' block in the block editor.
- Run the program.
- 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..