Visualizing Achievement Gaps with Tableau (part 2)

Next, we’ll build out the chart at the bottom of the visualization I shared in part 1. This visualization is a little trickier than the last as we’ll be creating a dual-axis chart.

The first step will be to set up the shelves such that our fail rates display as columns and our course descriptions display as the rows. You do this by dragging the “Fail” field into the columns shelf *twice*:

The default measure for the “Fail” is SUM, which displays the raw number of students who failed the class. We want to see the percentage of students who failed, so we need to convert the measures for the “Fail” fields to averages:  

Now, the goal of this visualization is to show a mark for each gender with a line between the two. The line between the two marks isn’t critical, per se, I just personally feel that it better illustrates the difference between the two genders. To do this, we need to have Tableau create a dual axis chart. This is done by right-clicking on one of the “Fail” fields and selecting “Dual Axis”:


Thus far, we’ve simply created a dual axis chart with all of the exact same information, so essentially, the marks from one axis exactly overlap the marks from the other axis. We need to go into the “Marks” shelves to start making modifications to this default. Because we’re interested in drawing a line between the two genders, we go to the “Marks” shelf for the first “Fail” field, change the dropdown for the mark type to “Line” (see red box ) then drag the “Gender” field to the Color box and again to the Path box. I have also added the SUM of the “Number of Records” field and the SUM of the “Fail” field to the Marks shelf as Tooltips. We’ll circle back to this, but this technique allows you to add additional information to the visualization through the Tooltip rollover feature.

The next step would be do make the marks for gender by adding fields to the “Marks” shelf for the second “Fail” field. The problem is that if we use the same “Gender” field, we need to use the same colors to designate the difference between male and female students. This means that the line between the two genders will display as a gradient that transitions from one gender’s color to the other gender’s color. The end result is something like this:

Depending on your audience, this gradient effect may be just fine. Should you want to show a solid color between the two marks, however, you’ll need to duplicate the “Gender” field and tinker with the colors a bit (more on that in a moment). First, to duplicate a field, head over to the list of variables, right-click on the one you want to copy and select “Duplicate”:

Next, head over to the “Marks” shelf for the second “Fail” field and be sure you have the dropdown for the type of mark set to “Shape” (see the top red box below). Next, put your new “Gender” field (the default name will be “Gender (copy)”) into the Marks shelf and set it as the Color. Finally, in order to make sure the Tooltip works correctly on both types of mark (Line and Shape) you’ll need to drag the “Number of Records” and “Fail” fields into the “Marks” shelf and set them as Tooltips:

This should give you a chart that looks something like this:

Obviously, this looks a little weird. Aside from the gradient issue mentioned above, the shapes and lines are all out of whack; here’s why: when you create a dual axis chart in Tableau, the top and bottom axes aren’t synchronized by default. You have to right-click on one axis or the other and select “Synchronize Axis”:

Finally, you’ll want to set the colors for the Line shape to bet the same; I chose grey but any color is fine. Do this by clicking on the “Color” box in the “Marks” shelf for the first “Fail” field. Next, click on “Edit Colors” and then you can set each gender’s color manually:

Once this is done, you should end up with a  chart that looks something like this:


Now, this essentially produces a massive, scrollable list of all courses offered in the Fall of 2015 and Spring of 2016. Alone, this isn’t the most useful chart. My plan is to combine the scatterplot from Part 1 to this gap chart and put them all into one visualization. Then, I’ll  use the same filters from Part 1 and set them to apply to all of the charts on the dashboard. If you choose not to pair the two into one visualization, you will likely want to add some filters to help your end users dig into the data a little bit better.

Finally, I created a new dashboard, added the two charts we’ve created in parts 1 and 2, and set the filters to apply to all worksheets using the underlying data source:

For the purposes of the blog post, I used a custom sized dashboard and brought everything in as “floating” objects rather than “tiled.” I find that this method gives a little more flexibility for design and, when done well, can help squeeze more onto a given dashboard. That said, it does require a little more tinkering to be sure everything is laid out in a way your end users find useful. I’ve chosen not to go into too much detail on that process here, rather, I’ll just embed the final product here:

Finally, my typical disclaimer: Though these dashboards are based on work I’ve done in my “day job,” the particular examples above use fabricated data.