Learn more in our free online course:
Statistical Thinking for Industrial Problem Solving
In this video, we show how to create a tree map using the S&P 500 data. Tree maps show values as rectangles in a rectangular display and are useful when you have categorical data with many levels.
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.
To create a tree map, we use Graph Builder from the Graph menu. We drag Company to the X zone and click the tree map icon.
To size the rectangles, we drag Market Cap (or market capitalization in billions of US dollars) to the Size zone.
The rectangles are displayed in alphabetical order.
To order the rectangles by Market Cap, we change the layout to Squarify.
Now we can see the top companies, in terms of Market Cap, on the left, and smaller companies on the right.
Each company belongs to a market sector. To group companies by sector, we drag Sector to the X zone, just in front of Company. This creates a nested tree map.
The rectangles are randomly colored. We can color by different variables in the data set. Here, we’ll color by Sector. To do this, we drag Sector to the Color zone.
Now you can see the largest sectors and the largest companies within each sector.
To make it easier to see the sector names, we’ll select Group Labels and then Above. Now, the sectors are separated by the labels.
Finally, we’ll change the label sizes and the label thresholds. This makes it easier to identify the largest companies across the different sectors.
We can see that five of the largest companies in the S&P 500 are in the Information Technology sector.
All data is licensed under the Open Data Commons Public Domain Dedication and License. All code is licensed under the MIT/BSD license.