Data Perspectives: Bar vs. Pie Charts in Visualization

Compare stock volumes using a bar chart to highlight differences between companies, offering a complementary perspective to the pie chart.

Learn how bar charts offer a distinct perspective compared to pie charts, especially when analyzing stock volume data by company. Understand the advantages of two-dimensional visualization in presenting comparative information more clearly.

Key Insights

  • Bar charts use two axes—company names on the x-axis and stock volumes on the y-axis—to show how each company compares in scale, making it easier to assess relative differences in data.
  • Unlike pie charts, which show how much of the whole each category represents, bar charts highlight the magnitude of difference between categories, providing a clearer sense of scale and comparison.
  • This article is part of a broader data visualization training series from Noble Desktop, which demonstrates how combining different types of charts can offer multiple perspectives on the same dataset.

This lesson is a preview from our Data Analytics Certificate Online (includes software). Enroll in this course for detailed lessons, live instructor support, and project-based training.

Let's add another visualization. So we're going to do a bar chart this time and see if it tells us any more information. Okay, so the first thing we're going to do is we're going to repeat to a large degree the code from creating the pie chart, but there are going to be some differences that will also kind of highlight what the differences are in these charts.

So let's make a bar figure and it's we can just call px dot bar and pass it a couple of values. First is still the data frame to work with and then we're going to say instead of values we're going to say x is the column company and that's because bar graphs really are working with two dimensions. If we're looking at our pie chart it's overall checking okay how much is each of these as a share of the whole, but a bar chart is really two-dimensional.

We're going to see for each company how high a bar it is for its volume. So along the bottom, the left to right, is what's the company name and how far up it goes vertically. That's the y-axis.

How high is the volume and we can put a title on it too and probably should. Visualizing stock prices or stock volumes as a bar chart and now we'll make a graph by saying bar graph, but we should spell graph right preferably, is what we get when we call dcc dot graph and pass it the figure we want which is that bar figure. And finally under this pie graph we could put bar graph.

Save it. That should reload it and further down here we can see our bar chart. Now there is a pretty significant difference in the story it's telling here.

This story is how much of the total is Apple. This is more how much higher is it than the other ones. They're similar but they really come at it from a different perspective.

This is looking at what's the whole and how much of that whole belongs to Apple. Whereas this is looking at hey like which is the biggest? How do they measure against each other? And you could you know you could kind of think about it and sort of try to visualize yourself from for each from the other. Right from the pie chart you can look at this and say okay so how much bigger a slice is that than this slice? But that's much harder to visualize than this bar chart which is like oh okay look at how much higher it is than Tesla.

It's almost twice as big. And the same thing we can look at this and try to think about like okay if we added up all these bars on top of each other then how much of that totally giant combined bar would Apple be? But you know again it requires this kind of like extra level of thought and it's kind of challenging thought honestly especially that second example. That's why these two serve a different end.

They compare different values in different ways or they compare the same values but in different ways that tells a different story that answers a different question. So it's very valuable to have both of these. We're going to take a look next at what a horizontal bar chart can tell us and what a scatter plot can tell us and how to add these to our dashboard.

How to Learn Python

Build practical programming skills with hands-on Python training. Python is a widely used, versatile programming language applied across data analysis, automation, artificial intelligence, and software development.

Yelp Facebook LinkedIn YouTube Twitter Instagram