In this video, we show how to create a packed bar chart using the S&P 500 data. Packed bar charts are useful when you have many levels of a categorical variable.
This example is from the S&P 500 from March 2017. The S&P 500 is a report of the market value (or market capitalization) for the top 500 companies in the US stock market.
First, we create a bar chart.
To do this, we use Graph Builder from the Graph menu. We drag Company to the Y zone, and click the bar chart icon. Then we drag Market Cap (or market capitalization in billions of US dollars) to the Freq zone.
There are 500 companies in the data set, so we can’t learn much from this bar chart. A packed bar chart is a better option.
To create a packed bar chart, we’ll change Bar Style in the side panel to Packed.
We can easily see the top companies in terms of market capitalization. There are 12 primary bars, and these are labeled and colored blue. The rest of the bars are packed to produce a rectangular fill.
Some of the bigger packed bars are also labeled.
There are many options in the side panel for customizing the graph. We describe a few of these options here.
For example, if we want to a different number of primary bars, we can change the number of packed primaries. Here, we see the graph with 10 packed primaries.
We can also change the packed labeling. We can show labels for more of the packed bars or show labels for fewer packed bars.
Here, we’ll remove the packed labeling by using the slider. We’ll change Summary Statistic to Sum, and select Label by Percent of Total Values.
We can see that the top four companies account for about 10% of the total market capitalization for the S&P 500.
As this example illustrates, if you have categorical data with many levels, a packed bar chart can help you identify the top categories.