Even Hexier than Before…

[This blog post is a result of working with Sarah Battersby (Spatial Overlord and all-around Crazy Map Lady) from our Seattle office. We worked together for a TC15 presentation “Go Deep: Interpreting Dense Data with Tableau” where she presented the technique for creating uniformly spaced hexbins. Thanks for doing all the hard work, Sarah! 🙂 ]

At TC15 I had the pleasure of presenting a session with Sarah Battersby, a research scientist from the Seattle Tableau office who is a specialist in hex. We talked about dealing with dense data and in her session she covered heat maps which naturally lead to a discussion around hexbins.

Back in March I wrote a couple of posts that showed how to create polygons that wrapped around the center points of hexbins calculated using the HEXBINX() and HEXBINY() functions. Here’s the output:


If you look closely, you can see that the shape of the polygons is gradually distorting as we move away from the Equator. By the time we reach Tasmania they are visibly taller than they are wide. This is due to the distortion effects of the Web Mercator projection we use in Tableau.

For some customers, it may be preferable to have polygons that are uniformly sized no matter where they are on the map. I’m not going to go into the pros/cons of doing this and how you might be distorting your data as the hexbins will not actually cover the same amount of area of the Earth’s surface – I’ll leave the details of that for Sarah if/when she ever finds this post. In any case, Sarah presented an elegant solution to this problem:

  • convert your lat/lon data into Web Mercator projection coordinates
  • create the hexbins in this coordinate system
  • calculate the vertex coordinates in WM coordinates
  • convert back to lat/lon and draw on the Tableau map

She outlines the maths for this in her slides:

Go Deep: Interpreting Dense Data with Tableau

You can see the results here – notice the hexagons are now uniformly sized no matter how far south we travel:


You can download the workbook from here to see the solution in action. Enjoy!

About Alan Eldridge

Hi. I'm Alan. By day I manage the APAC sales engineering team for Snowflake Computing. By night, I'm a caped crusader. Or sleeping. Most often it's sleeping.
This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Even Hexier than Before…

  1. Alan,

    Great work! Thanks for this contribution to the community. Tableau has the best community in software. I wanted to see your presentation at TC15, but there was too many other options at that time.

  2. Stuart Dunlap says:


    Thanks for the post and the great supporting example! Your numbering of the different formulas made it very easy to follow a complex process. I saw the TC15 recorded session you and Sarah presented. (I had to go back to catch some things I missed – and it was well worth the time.)

    I have a few questions if you have time to elaborate on this approach…

    1. In the ‘Map Pins’ worksheet of the sample workbook you posted, if I have Scale set to ‘Km’ and ‘Hexbin Side Length’ set to 200, the top of the range of SUM(Num Volunteers (bin)) calculates to 2,784. When I change the ‘Hexbin Side Length’ to something smaller, say 150 Km, then the top of the range of SUM(Num Volunteers (bin)) actually increases to 3,012. My first thought was that a smaller Hexbin Side Length would translate to bins with fewer volunteers. I hope my question makes sense??? It just seems like if the bin represents a smaller area of geography, then you should have fewer volunteers for all bins. (unless the hexbin centroids shift and you end up with a hexbin that is positioned to capture more volunteers).

    2. When I try to make a dual axis map – using a hexbin for one of the maps and geography pie charts on another map, when I synch the axes, the viz is smaller. It’s as if the scale is changed. Have you ever tried to synch axes for a map with hexbins?

    Thanks again for a great post.

    • Hi Stuart,

      Thanks for your comments and I’m glad you found the material useful.

      In response to your first question, it’s just that as you change the hexbin size, the boundaries are moving across a high density region (Sydney) and this means that some volunteers are shifting between bins. If you watch – you will go from having two adjacent bins with moderate user counts @ 200Km scale to one bin with a high count surrounded by bins of low count. Seems odd at first glance but it makes sense.

      For your second question, I haven’t messed around with it too much. I’m happy to have a look at your workbook if that would help… you can email me directly at aeldridge at tableau dot com.


  3. Pingback: Use Tableau to Create Census Tract Map – Data & Web

  4. Pingback: Custom Map – Data & Web

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s