WeCodeAcademy

Choosing the Right Chart

The first design decision is the chart type, and it follows from the question you want the chart to answer.

QuestionChart
How does a value change over time?Line chart
How do categories compare?Bar chart
How is one set of numbers spread out?Histogram or box plot
Are two numbers related?Scatter plot
What share does each part have of a whole?Stacked bar (or a pie with very few slices)

Ask the question first, then pick the chart. The example draws the same marks four ways so you can see how each type answers a different question.

Examplepython
Open in editor »
Quick check

You want to show whether study hours and marks are related. Which chart?

Your turn: write the code

Draw a histogram of the ages list with 4 bins and print the number of bars it drew (use len(ax.patches)).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.