3 Comments

    Leave a Reply

    Your email address will not be published.

    How to Visualize Age/Sex Patterns with Population Pyramids in Tableau

    Updated on: Nov 27th, 2018
    Data Visualization
    , , ,

    Deven Wisner is a frequent Depict Data Studio collaborator, a personal friend, and an all-around awesome data nerd. Check out his additional articles about getting started with Tableau, customizing fonts, and customizing colors. –Ann

    —–

    If you’re like me, you were probably inspired to revise some of your charts after reading Ann’s How to Visualize Age/Sex Patterns with Population Pyramids. Too often when I storyboard demographic information I default to separating out this demographic information (you know, for the sake of keeping things simple). Unfortunately, this is sometimes a missed opportunity to provide a more comprehensive picture. These things combined inspired me to recreate the Pyramid Chart in Tableau — Let’s get started!

    The Data

    The dataset we’ll be using is from the Arizona Office of Economic Opportunity, which you will see consists of age groups, sex (male/female), and population. If you receive disaggregated data, that wouldn’t be a problem — that’s Tableau’s specialty!

    Tableau dataset.

    The Hack

    We want to load our data source, review that our variables came in correctly, and add a new sheet. Next, we’ll drag two Population pills to Columns.

    We want to load our data source, review that our variables came in correctly, and add a new sheet.

    Now drag Age Group to Rows. You will want to click the arrow and uncheck Show Header.

    Now drag Age Group to Rows. You will want to click the arrow and uncheck Show Header.

    To get our Age Groups in the middle, we need to hack Tableau a bit. Start by creating a Middle calculated field — all you’re doing is entering “0” and saving. Next, drag the Middle pill between your Populations. On the Marks Card, add Age Groups as a text item and change the type to text.

    To get our Age Groups in the middle, we need to hack Tableau a bit.

    Okay, we’re making progress! Realizing our pyramid (or butterfly) is dabbing, we need to reverse the axis of our population on the left.

    Realizing our pyramid (or butterfly) is dabbing, we need to reverse the axis of our population on the left.

    Note: You might need to sort Age Groups, as I did (see above where Under 5 years is after 85 years and over).

    In order to highlight females on one side and males on the other, we need to create a couple calculated fields.

    In order to highlight females on one side and males on the other, we need to create a couple calculated fields.

    On the Marks Card, add Female as a text item to one population and Male to the other. Now we have the shape of something, but you probably noticed that the comparison is about as helpful as a table.

    To change that, we’re going to get crafty with colors and create a calculated field for each. This will allow us to control the colors independent of one another while still maintaining the same x-axis (i.e. Population).

    To change that, we’re going to get crafty with colors and create a calculated field for each. This will allow us to control the colors independent of one another while still maintaining the same x-axis (i.e. Population).

    After creating your Female/Male Color calculated fields, you’ll want to drag them to their respective Color Marks Card. Next, edit the colors and be sure the “0” (i.e. the sex you don’t want to call out) is something very light.

    After creating your Female/Male Color calculated fields, you’ll want to drag them to their respective Color Marks Card. Next, edit the colors and be sure the “0” is something very light.

    Additional color tips: You’re better than basic — use something other than the default blue and orange Tableau gives you. You should also avoid using traditional blue and pink to represent male/female (this is 2018, after all!).

    Our final steps will be cleaning up our visual. First, I want to get rid of unnecessary borders and lines across the entire sheet (they’re just a distraction). I would also hide my axes, as I have labels on my bars.

    Our final steps will be cleaning up our visual.

    Speaking of the labels, I want to format (SUM)Female/(SUM)Male to be a nice round number and change my units to thousands (K). You should use your discretion when doing this but for the purpose of this chart, I know my readers aren’t actually distinguishing between 200,010 and 200,500.

    Speaking of the labels, I want to format (SUM)Female/(SUM)Male to be a nice round number and change my units to thousands (K).

    Last but definitely not least, I want a descriptive title that pulls readers in. You’ll notice that I also leveraged colors in my title to differentiate between each side of the pyramid.

    Last but definitely not least, I want a descriptive title that pulls readers in.

    Bonus: You can go the extra mile and include some great information in your tooltips, too. Often, percentage of an entire population is a really important piece of information. The tooltip is a great way to provide that without adding distractions to the visualization.

    Bonus: You can go the extra mile and include some great information in your tooltips, too. Often, percentage of an entire population is a really important piece of information.

    More about Deven Wisner
    Working with Deven is like working with an old friend. He looks out for your best interests, helps guide you toward good decisions, and sometimes—when you need it—lets you know when you’re wrong. He has the ability to make everyone around him feel comfortable, which makes partnering with him effortless and collaboration more than just easy, but fun. He believes building real relationships with clients is the secret ingredient to generating inspiration and action, and he pairs this belief with his background in evaluation, industrial-organizational psychology, and senior-level management experience to help both non and for-profits leverage data to make decisions that can change their organizations for the better. Outside of Viable Insights, Deven teaches Organizational Behavior and Psychology of Leadership at the University of Arizona, is a board member of the Arizona Evaluation Network, an active member in the American Evaluation Association, and co-founder of the Tucson Tableau User Group.

    3 Comments

      Leave a Reply

      Your email address will not be published.

      You Might Like

      Our complimentary mini course for beginners to dataviz. Takes 45 minutes to complete.

      Enroll

      Inside our flagship dataviz course, you’ll learn software-agnostic skills that can (and should!) be applied to every software program. You’ll customize graphs for your audience, go beyond bar charts, and use accessible colors and text.

      Enroll

      Subscribe

      Not another fluffy newsletter. Get actionable tips, videos and strategies from Ann in your inbox.