Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a pie chart where elements can belong to multiple slices?

I'm trying to visualize some data as a pie chart. My data is structured as a list of (Season, Int) tuples, where the integer represents the number of items that are available for a particular season.

The difficulty is that one item can be in multiple seasons: an item can be valid for both fall and winter.

Is it possible to display this information as a pie chart? It's not clear what the denominator should be when calculating percentages, because the sum of the counts can be greater than the total item count.

As an example to make it clearer, let's say I have 10 items. A valid dataset might be:

  • (Fall, 4)
  • (Winter, 5)
  • (Summer, 3)
  • (Spring, 10)

The total number of items represented here are 22, but there are truly only 10 items.

Calculating the fall percentage as 4 / 10 doesn't really make sense, but neither does 4 / 22.

Is this data just not compatible with pie charts (or other percentage-oriented charts)?

like image 201
Bill Avatar asked Aug 11 '17 19:08

Bill


People also ask

How do you create a pie chart with multiple data?

Excel. In your spreadsheet, select the data to use for your pie chart. For more information about how pie chart data should be arranged, see Data for pie charts. Click Insert > Insert Pie or Doughnut Chart, and then pick the chart you want.

How do you add more slices to a pie chart?

Right-click the pie chart, then click Format Data Series. Drag the Pie Explosion slider to increase the separation, or enter a number in the percentage box.

What type of chart is best for comparing multiple items at once?

Use a stacked bar or stacked column chart to compare the compositions of multiple values.


1 Answers

It depends on what business question the plot tries to represent. There are best practices that we use in data visualization. These best practices are guided by statistics and human perception. We want the plot to immediately tell the story.

Reading your post it looks that the business question you are trying to answer is: What is the percent of items available in each season, relative to the overall (total) number of items the company has. Using the numbers in your post 100% of the items are available in the spring, and only 50% of the items are available in the winter.

This is great business question to visualize (if this indeed is the business question you are trying to solve) but you can't use a pie chart for it. Pie charts must represent 100%. Bar charts are good for comparisons and I recommend you would use them. You can make the y-axis units be percent, and have 4 bars along the x-axis.

Bar charts do not have to (statistically) add to 100% but if you are concerned that people may be wondering about it, you can achieve the same effect by making the y-axis a count of the number of items in each season. The plot will still show the relative number of items available in each season. This is another good reason to use bar chart in this case.

Lastly, note that pie charts look nice but they are also not recommended from human perception point of view. It is hard for us to compare the relative size of the slices.

like image 96
Rahav Avatar answered Oct 23 '22 14:10

Rahav