# Whats the best way to graph percentage data?

Lets say I have the following data:

``````     Category  positive   neutral  negative  total
0  Category 1  1.000000  0.000000       0.0      2
1  Category 2  1.000000  0.000000       0.0      1
2  Category 3  0.222222  0.277778       0.5     18
``````

The data represents the proportion of each category that are positive/neutral/negative (valence), and I want to communicate 2 pieces of information with a graph:

1. Positive + neutral + negative make up 100% of each category
2. Whether the category is primarily made up of positive/neutral/negative and their relative proportions

Stacked bar chart

The first thing I tried was a stacked bar chart:

With a stacked bar chart its not clear what values represent. For example, how should Category 3 negative group be interpreted? Is it 50% because it covers only half of the vertical height of the bar? Or is it actually 100%, just that positive and neutral are covering the bottom half?

Also, I think the valence proportions are unclear due to the stacking. For example, what proportion of Category 3 is neutral? Its unclear because the baseline has been elevated and no longer at 0.

Grouped bar chart

Next I tried a grouped bar chart:

I think this solves the baseline problem, and its easy to compare relative proportions within each category, but it introduces 2 new problems:

1. Categories where only a single valence is represented (e.g. Categories 1 and 2) only have 1 bar, creating an unbalanced graph. This could potentially confuse the user briefly, until they realize those bars are at 100%
2. For Category 3, its no longer clear that positive + neutral + negative make up 100% of the data within that group.

I did also briefly consider a grouped bar chart with raw count values instead of percentages, but this is problematic because totals across categories are quite unbalanced (e.g. 18 vs. 1), and what I'm primarily interested in is valence distribution within each category (i.e. are there more positive than negative in Category 3?)

Whats the most effective way to communicate this type of data? Is this one of the rare occasions where a pie chart is recommended?

• It looks like you are trying to chart sentiment analysis information? Perhaps you could look at some of the social media monitoring platforms and see how they tackle a similar problem with their data visualization. – Michael Lai Oct 11 '18 at 23:48
• Also, I don't think this is one of those situations where a pie chart is necessarily better :p – Michael Lai Oct 11 '18 at 23:48

A Bar or Column chart is the best option here. You can easily compare values when they are adjacent. In order to get around the problem you mentioned of "creating an unbalanced graph" you can add labels such that the value is evident:

or you could set a minimum value so that a little bit is showing:

To address you second issue of it no longer being clear that the sum is 100%, you can show the percentage unit, and the reader will assume from the pattern that the sum is 100%. Having a good title will also help, "Percentage Split of _____":

I hope this helps, it makes me wonder though if there is a software that can implement it without much headache

• Shouldn't be too hard to implement using something like d3.js? – Michael Lai Oct 11 '18 at 23:49
• no clue to be honest, haven' tested the library myself but it's popular for a good reason – UX Labs Oct 11 '18 at 23:52

It is not a complete answer because I think there is still some context lacking with exactly what you want to show in the graphics (which is probably the first thing to consider rather than the type of chart), but as suggested before there are similar data visualizations used for displaying sentiment analysis.

There is a research paper that goes into some of the finer details involved, but without going through all the details, you can see some of the examples if you look up some of the service providers in this space including:

• IBM Watson
• Lexer.io
• Falcon.io
• Sendible
• Hootsuite
• iSentia

And more so you can see some variations in the way sentiment analysis information can be presented. Keep in mind that if you are only focusing on a specific social media channel, the way you want to present this might be different to combining different social media channels as well.

You want a chart that shows how some whole is divided up among its constituent parts. Popular convention may tell you to think in terms of a pie chart.

As an example, here’s a pie chart with three categories, showing your data with three types.

It’s clear from the chart that almost half the pie is neutral. You can also probably tell that negative represents more than a quarter and being approximately equal to neutral's share. But you might struggle to tell whether the difference between neutral and negative is greater or less than each other. We are much better at spotting straight lines and right angles than we are at accurately estimating acute and obtuse angles (see, for example, the introduction here).

While pie charts do naturally give us a sense of part-to-whole, we’re not very good at the perceptual tasks required to decode most of the data encoded within them. Research has shown that we are more adept at perceiving lengths and positions along aligned scales – typical visual tasks when reading a bar chart – than we are at judging angles and areas as we do when studying a pie chart.

Of course, charts should have proper labels, so we can add those. The relative differences are now obvious from the pie chart because we can read the labels. But that’s using verbal rather than visual reasoning. We can read numbers from a table too, but the table has the advantage of alignment. And a simple sentence stating the values – eg “44% of the pie is neutral, 39% is negative, and 17% is positive.” – takes up much less space.

This is in-line with the research by Spence and Lewandowsky that suggests we are better at judging summed combinations of sectors in pie charts than of bars in bar charts. Taking that research at face value leads to an obvious question to ask oneself – is the purpose of your chart to allow the intended user to compare arbitrary combinations of components with other arbitrary combinations of components? If so, a pie chart may be a reasonable choice (especially if the data gives rise to summed shares of 25% or 50%).

Finally, a popular alternative to the pie chart is the doughnut chart, where the center of the pie has been removed and (frequently) replaced with some text.

• As a general rule, never use a bar chart for anything that has more than 2 values. In your example, not only is the 3D effect distracting, but you can't tell which is bigger between Neutral and Negative without looking at the text. – mrchaarlie Oct 12 '18 at 14:29
• I would say that using this style of visualization (3D pie-chart) that the percentage of Neutral and Negative look quite similar. – Michael Lai Oct 12 '18 at 22:24