Data Science Hour of Code

Activity 5: Customizing the Colors

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:

You can select many different columns and factors at the same time. This breaks our data down into more and more groups, which each have their own color assigned so that we can differentiate them in the Chart. The first column we select is plotted against each of the other selected columns, and those sets are separated into groups based on the selected factors. So if we select Columns bill_depth and bill_length, and then we select Factors species and island, we end up getting 5 total groups of data (Note: not all of the species live on each island). Each of these comparisons is called a Series and is listed in our Legend. The points for each Series have a unique color, that way you can compare the trends. In this case, the default colors used are Dark Blue, Light Blue, Green, Teal and Purple. If you don't like these colors, there are many color palettes to choose from.

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 with two Series. Take code blocks from the palette and place them below where we make the Chart object but before we Display it.

  1. Use the block(s) in the palette on the left.
  2. Place the 'chart:SetColorPaletteToCalm()' block below the 'ScatterPlot chart = frame:ScatterPlot()' block in the block editor.
  3. Run the program.
  4. To try other color options: stop the program, delete the block you added to the block editor and place one of the other blocks from the palette in the same location.
  5. 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 Separating into Sub-Charts, which describes how to separate the Chart into several Sub-Charts..