Charts and data visualizations help us to make sense of the world around us. They are most helpful when we can connect what we see on the page or screen to our everyday understanding of the world.

We can make that connection easier by picking a chart that, whenever possible, leans on the audience’s real-world interaction with the data. For example, consider whether your data is better suited to a horizontal or vertical presentation. Simply changing the orientation of a chart can have a big impact on its readability – check out this example with two boxplots:

A boxplot of finishing times for a half-marathon makes most sense as a horizontal box plot, since linear time is often visualized horizontally from left to right (and distance is a “horizontal” measure).

A box plot of women’s heights, on the other hand, makes sense visualized as a vertical box plot, since we measure standing height as a vertical measure.

No matter the type of chart, this simple choice can help to start the viewer off on the right foot.

In the Jupyter notebook, we’re going to visualize the average tree heights of the five most common plant families in our dataset. We’ll visualize both the crown_base height (the trunk) and the depth_crown (the leafy part). What do you think will be the clearest way to communicate that visually?



Run the Setup cells to load our data. We’ll work from the avg_heights dataset. We want to visualize height, so we’ll use a vertical bar chart. First, make a bar chart of the trunk heights for each family using avg_heights.trunk.


To visualize the crown (leaf) height, let’s make this a stacked bar chart. Simply make a second bar chart for the crown heights using avg_heights.leaves, and add the argument bottom = avg_heights.trunk so that the bottom of the leaves bars are positioned at the top of the trunk bars.


For good measure, add in a title, xlabel and ylabel: ‘Trunk, Crown, and Total Height’, ‘Family’, and ‘Average Height (m)’, respectively. If you wish, change the graph colors and/or bar width.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?