Visualizing Demographics: Building Population Pyramids in Tableau
Exploring Population Data: Creating Pyramids with Tableau’s Visualization Tools
Insightful Demographic Analysis: Leveraging Tableau for Population Pyramid Visualization
A population pyramid is a histogram type of graphical representation that shows the population by gender where values are stacked top to bottom from high to low or low to high. Some analysts call it a step chart because it looks like a flight of stairs.
From a broader view, it represents a triangle or a pyramid structure. It can also be built as an area chart to give a smoother appearance rather than a step shape.
Understanding Population Pyramids: Key Concepts and Applications in Tableau
Step-by-Step Guide: Implementing Tableau Techniques for Population Pyramid Creation
Tableau Features: Leveraging Tools for Effective Population Analysis and Visualization
Practical Applications: Real-world Examples of Population Pyramid Visualization with Tableau
Exploring Tableau Tools: Techniques for Creating Population Pyramids with Ease
Advanced Data Visualization: Tips for Optimizing Population Pyramid Visualization in Tableau
Tableau Best Practices: Maximizing Effectiveness in Population Analysis and Visualization
Effective Data Visualization: Using a population pyramid in Tableau
A population pyramid can be used to represent Male and Female population across time or can be used to show various age groups and gender combination across a single census year. The concept can be used to show data distribution for adults vs children, diversity for job hiring in companies, consultants vs full time employees, in house projects vs contracts and vendor projects, income vs expenses, deficit vs surplus etc. The list can go on. Since it is very popular use case for population, we rarely see them being used for anything else.
Breaking down a population pyramid chart/graph
The anatomy of a population pyramid shows the measure or metric of interest which is the Population plotted on the horizontal X-axis. The Dimension of interest is the Year or Age bucket plotted on the vertical Y-axis. The Genders are plotted on either side of the axis to show the pyramid structure.
There are many ways to do this chart type. The same method can be used to create a Butterfly Chart.
Our idea is to attempt one of the charts shown below. The first chart is a Wikipedia image, the second one is from the Vizwiz blog.
There are a few blogs that show some features but are not very focused on creating the pyramid structure per se.
So, using some hacks and tricks, a chart is created in Tableau Dashboard to look similar to the ones that are available online.
The graph will be created in such a way that the Female population will be on the left, the Male population will be on the right and the Total population with the Year in the center.
We shall be discussing two methods to create this chart. The first method is a crude method that has multiple pieces assembled on a Dashboard. The second method is a more powerful one where all changes are done in the same data visualization.
We will go into all the steps required to create this chart. There will be a lot of hacks and cosmetic changes required in the process.
For this example, we are using a very simple Male and Female population for the USA across time. Using this data in Tableau, we want to arrange from Low to High i.e. 1950 to 2015, Top to Bottom for each Gender.
All the Number formats in Tableau will be converted to Millions for easy representation.
Method 1 – Build Population Pyramid in Tableau
This method is a more simple approach. The graph will be created/assembled in such a way that 3 pieces, one for Female Population, one for the Male population distribution respectively, and one for the Total population and Year are built first. All three pieces will be brought together on a Dashboard.
1) We will start with the first visualization; the female population across all years as a horizontal bar chart. Females measure as a Sum aggregation on Columns and Year dimension on Rows.
2) Next, we need to reverse the axis such that it looks like a negative scale but the values represented will be positive.
3) Next, we need to create another sheet for Male Population similar to the first step. This visualization will not have changes to the axis.
4) To create the pyramid structure, we need to place both the sheets together within a Dashboard.
5) Now, we need a placeholder in the center to show the Total population and Year. For this, we will create a new worksheet – the sheet is used on the Dashboard between the two existing sheets.
There are some steps involved here. We will use the Year field on Rows, Use the Number of Records as Dimension on the Size card of the Marks shelf and finally convert the Marks to a Bar chart.
6) Next, we need to add labels to each of the individual sheets.
7) Next, we need to work on the cosmetics. We also need to change the colors, label formats, line, and border formatting, remove unwanted headers, remove all the titles, place some empty text boxes or blank objects to adjust the height of the placeholder on the dashboard.
After all the changes, we arrive at this view.
Method 2 – Build Population Pyramid in Tableau
This is a more sophisticated method. We need to make sure that all the measure values used in creating the visualization are of the same data type.
1) Create a multi-measure horizontal bar chart with Male Population and Female population across years. For this, we do not need to Measure Names or Measure Values. It is very straightforward i.e, by placing 2 bar charts one next to others in the same sheet.
2) Next, we need to reverse the axis for the left measure similar to Method 1. For this, we need to flip the axis of Sum (Females) such that it looks like a negative scale.
We can stop at this stage because the pyramid is ready. But we need to make it colorful – what’s visual analytics without a little color and animation after all? Further to this, we need to place the Year and Total population in the center just like we have in the previous Method.
3) Based on the existing scale, we shall pick a number that is just enough to fit the Year and Total population. The idea is to use this piece in the center of the chart such that it looks like all the 3 pieces are combined.
For the current scale, we shall pick negative 20 Million. Why does it have to be negative? The answer to this will become clear in future steps.
4) Using this with Minimum aggregation on the Columns shelf. The Sum will add it across every row and provide a huge number. So we are going with Min. Max and Avg aggregation functions will work too.
** If the metrics on either side of the pyramid are not related, it would be a good idea to keep the axes synced. It can be done using dynamic Reference Lines. This also helps when filters are applied. Thanks, Moyses for pointing this out.
5) Next, we need to bring the placeholder bar chart in the center. For this, we will be using a Dual Axis with the Males measure.
6) Next, we need to Synchronize the Axis and convert everything to a Bar Chart. This step is very important. Since the placeholder is of negative values, it shifts to the left of the Males measure.
7) Now, we have a small white space between the placeholder and the Females measure in the bar chart. This is because Tableau adds a little extra to the axis automatically as a buffer. That can be modified by editing the axis and fixing the start value. We need to make sure the end value is untouched. This way any increase in value will be accommodated as data changes.
8) Next, we need to add the appropriate labels into each of the segments of the Marks shelf. Though these steps are not necessary, keeping this visualization as the point of view, these steps are discussed here.
9) Next, we need some cosmetic changes. Color changes, size changes, grid line formatting, number formatting, removal of headers for secondary axis and the dimension, adjusting labels, etc.
After all the changes, we arrive at this view.