A common task in data visualization is to compare the sizes of categories. For example, in our vehicle data we might want to compare how many cars are being produced as opposed to SUVs or trucks. Column charts and pie charts are simple ways to visualize categorical data and make comparisons.

For this exercise, we’ll look at a dataset containing data on the production shares (%) for different types of vehicles in 2020 (from the Bureau of Transportation Statistics).

A table in Excel. There are two columns: vehicle type and percent. The vehicle types are: Car, 30.9%; Car SUV, 13%; Pickup truck, 14.4%; Van, 2.9%; Truck SUV, 38.7%

Column charts

In column charts, each category is represented by a column in the plot and we can compare them by assessing the length of the columns or bars. Note that these are commonly also called bar charts, but the tool in Excel calls them column charts.

A chart titled Production share by vehicle type. Horizontally, there are columns labeled car, car suv, pickup truck, van, truck SUV. The heights of the columns are measured by a vertical axis going from 0 to 45 in steps of 5. The column heights are in order truck SUV, car, car SUV, pickup truck, van, truck SUV

Pie Charts

In pie charts, each category is viewed as a “slice” or sector of a pie, with the size (or area) of the slice corresponding to the relative size of that category. Because the categories as slices make up the whole pie, pie charts should only be used to visualize categories that are pieces of some whole. In other words, the area of the sectors (slices) should add up to 100%.

In our dataset, the different vehicle categories are all part of the same whole: the collection of all vehicles in 2020.

A pie chart that pictures each category as a slice of pie, with the size of the slice relative to how big that category is.

Let’s look at a related dataset that might not be very suitable for pie charts. This table shows the production share of cars from 2015 to 2020:

A table in Excel with Year and Percent columns. The Year column goes from 2015 to 2020. The percent values are: 47, 43, 41, 36, 32, 30.

While we can certainly plot a pie chart, it would be misleading, because these percents are not pieces of the same whole. They are each “slices” of their own year, and shouldn’t be placed together in a pie. Make sure to evaluate your data to see if a pie chart is a right choice for visualization!

We’ve placed a slideshow illustrating how to create both types of charts in the learning environment. When you’re ready to practice this yourself, move on to the next set of instructions!


When you’re ready to practice what you’ve learned, download and work through our exercise spreadsheet. A couple of important points to keep in mind:

  • Unlike formulas and pivot tables, we can’t automatically assess your visualizations. We have placed solutions to each exercise within the same spreadsheet. Feel free to compare your work to ours if you get stuck or to check if your solution is correct. Your visualization may not look identical to ours and that’s okay!
  • There are lots of options we haven’t covered — feel free to play around and see how different options work!
  • You can always re-download the spreadsheet if you want to start fresh.

Once you’ve finished, think about the next question.

Question: The column chart and pie chart you’ve created reflect the same data. What is the advantage of using each type of visualization?

Our Answer
It depends on the story you want to tell! You would use a pie chart, for example, to emphasize that vans, trucks, and car SUVs make up less than half of the vehicles produced. If you wanted to compare individual categories, a column chart would be better. It is very difficult to tell from the pie chart whether pickup trucks or car SUVs had more vehicles produced. The column chart communicates more precise values.

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?