Editor’s note: Alt Viz is an occasional series that aims to help you go beyond bar charts and line charts. The series will showcase various types of visualizations and outline how to build them, when they should be used, and when they should be avoided altogether. This post builds on the tutorial by Tableau Zen Master Matt Chambers who first outlined the steps of building a hex-tile map in Tableau. Check out the post on his blog, Sir Viz-a-Lot.

Rather than creating my own soapbox, I will choose rather to jump off the one created by my speaking partner at TC16, Ben Neville, in his initial post for this blog series.

Ben and I presented “Advanced Mark Types: Going Beyond Bars & Lines” at TC16 in Austin. As a follow-up to that session (available on-demand here), Ben and I will be sharing a more in-depth blog post for each of the charts we built live during our presentation.

As Ben noted in his introduction, there are visualization best practices that neither of us suggest you ignore. However, from time to time, it’s okay to “look the other way” in the interest of telling the most meaningful and engaging story for your audience with your data.

Let’s take a look at a chart type that has been growing in popularity amongst the Tableau community, the hex-tile map.

Common use cases:

  • Eliminate the Alaska effect on US maps (more on this below)
  • Eliminate discrepancies in US state sizes
  • Provide a more modern web look

Not ideal when:

  • Geographical precision is important

Take a look at the following map. The data here shows, by state, the percent increase in expected student debt for students graduating in 2004 compared to those graduating in 2014.

Does anything pop out at you? Not really, with maybe the exception that Alaska is really, really BIG. Not only is Alaska big—more than 2x larger than the next largest state, Texas—but the Earth is round. And when we try to present a round object on a 2D screen, the land masses near the poles, i.e. Alaska, will appear larger than they actually should. This is bullet point one above.

Due to the size of Alaska, in addition to its relative lack of proximity to the “lower 48” (or those states not know as Alaska or Hawaii), including geographical precision can be costly when it comes to delivering your message.

Adding more distortion to this message is the fact that the states in the eastern part of the US, especially those along the Northeast seaboard, are typically far smaller than those in the western portion of the country.

In the example below, there are two states that are performing significantly worse than the others, but that story is very hard to derive for the audience. It certainly isn’t popping off the page like it could.

Enter the hex-tile map: same data, different story:

Here it should be pretty obvious, almost immediately, that both Maryland and Delaware have experienced increases significantly larger than those of most other states. By leveling the size of each state and by bringing Alaska and Hawaii closer to the action, the story is now popping right off the page.

Now, you might be eager to draw some additional conclusions. Like, the West seems to have fared much better than the East, or there may be an issue just west of The Mississippi River. But this is where a hex-map can be the wrong choice of maps and may not win with best-practice hardliners. Look how far west Kentucky is pushed with this plotting. Kentucky is in actuality well east of the big river. And being from North Carolina, I know for a fact that Virginia is due north, not due west. So pick you poison and be sure to provide the right level of context so that your audiences is alert and can avoid any common pitfalls.

So how do we build one of these bad boys in Tableau? Easy enough. You’ll need to a get a hex-map plotting for your states (or whatever geographic bodies you want to map). I have included the mapping used for the example. And you’ll need a custom shape (check out this Online Help guide for more on creating custom shapes). Once you have your two files ready to go, it’s a walk in the park:

1. Join your data

Join your data (in this case, StudentDebt.xlsx) to your hexmap plots (HexmapPlots.xlsx). For the two provided data sources, your join should like this:

2. Add your mapping coordinates

Bring your mapping coordinates from your hexmap-plot data source as follows:

  1. Right-drag "Column" to the Column shelf. Choose AVG for the aggregation.
  2. Right-drag "Row" to the Rows shelf. Choose AVG for the aggregation.
  3. Drag “Abbreviation” to Label.

3. Reverse the axis for Row value

Notice that it appears our states are aligned yet upside down. This is due to the coordinates from our HexmapPlot.xlsx file where the states in the north had a lower value than those in the south. To correct this, we simply need to reverse the axis for the “Row” value:

  1. Edit Row axis
  2. Set scale to reversed

4. Add custom shape

Next we’ll want to change the default “circle” to our “inverted hexagon” custom shape. As noted previously, you will want either a .png or .gif for purposes of color fill. You will find a .png file attached (InvertedHex.png) thanks to Tableau Zen Master Matt Chambers. Tableau works with square tiles, so if you color other image types, it will color the entire tile.

  1. Change Marks type to “shape”
  2. Click shape > more shapes > go to wherever you have saved your hexagon .png or .gif

5. Adjust size

Adjust size manually until the form a honeycomb shape. You will want to minimize the amount of whitespace between objects.

6. Add color

Set the color mark for the measure you wish to analyze. In this example, we are looking at the average-debt percent change from 2004 to 2014. Rather sticking to the default color palette, I’d recommend something that will pop a little bit more, i.e. red-black.

  1. Add “Ten-Year Change, Average Debt % Change, 2004 to 2014” to Color
  2. Change color to “red-black diverging” color palette
  3. Check the “reversed” box

7. Format labels

We’ll want to have the labels right on the hexagons for quicker analysis.

  1. Change alignment to center for both height and width
  2. Set font to bold (and white, if you prefer)
  3. Check box to allow labels to overlap (they won’t)

8. Clean up your view

Remove as much of the “non-data ink” as possible. Think Edward Tufte here. Do you need gridlines or even axes at all?

  1. Remove all grid lines
  2. Remove zero line
  3. Unshow headers
  4. Resize accordingly

That’s all there is to building hex tile maps in Tableau. Join in some plotting data, add a hexagon file to your custom shapes, do some dragging and dropping, and voilá! You’ve got a beautiful hex-tile map visualization.

Explore more Viz Whiz posts

When to use a lollipop chart and how to build one

You might also be interested in...

Comments

Despite my best efforts, and following these instruction exactly, I still cannot get the abbreviation labels to be aligned with the center of the hexagons. I opened the example workbook and my settings seem to be the same. Any ideas as to what is causing the issue for me? I can't share my workbook, unfortunately.

The misalignment is because the image of the hexagon in the link has extra transparent space around the shape and the hexagon shape is not centered in the full image space. You can fix this by opening the hexagon in an imaging editing software that allows you to preserve the transparent background, such as Photoshop, (some software such as Paint will convert the transparent background into white) and crop it to a new rectangle that is as close to the edges of the hexagon as possible.


Add new comment

Subscribe to our blog