1. Why and when can we use Hexamaps
Few weeks ago, a colleague asked what would an Hexamap of Switzerland look like. And it’s true that we often see Hexamaps representing the US but rarely other countries.
The following Hexamap, designed by Jacob Olsufka (find the interactive version here: https://goo.gl/qRfpiR), is an amazing example of a good usage of this kind of viz:
The biggest advantage on this map is that all elements have the same size and small states from the east coast are visible, compared to a classic geo map:
Switzerland also has big-size cantons (Valais, Bern, Graubünden) and tiny ones (Basel-Stadt, Nidwalden,…) and an Hexamap could be useful to have a full view of each.
2. Prepare the data
The questions now are how to create an Hexamap from scratch and will the result be accurate (meaning the shape of my Hexa-Switzerland should be as close as possible to the real Switzerland).
First, I need to find on the internet a map of the country and its cantons that I will use as a background image to locate each hexagon.
I then quad the map with horizontal and vertical lines, using the same spacing and trying to make the intersections as close as it can be to the real canton position.
Here is the result:
At last, I just have to record the X,Y position of each canton in Excel and I can use it in Tableau with my data, et voilà :
By the way, Tableau doesn’t provide hexagons in its default shapes, you will thus have to find that shape on the internet.
3. Set Latitudes and Longitudes
Looking this viz alone, it’s not clear that we are talking about Switzerland. The global shape is close but if we could use those hexagons on a map, it would be awesome, right? And guess what, it’s really easy if your elements are recognized as geographic in Tableau.
Just drag and drop the cantons and their Tableau generated Latitudes and Longitudes and copy-paste it in Excel.
In Excel, you just have to get the min and max values, for longitudes and latitudes, and calculate the space between each hexagon by dividing the difference between max and min by the number of spaces.
Rank 1 latitude and longitude value correspond to the min values and the value of the following lines and columns are increased by the value of the step. At last, we just need to give the longitude / latitude values to each canton, depending on its, respectively, X / Y position.
And now we have it:
4. Other things you should care about
Some precautions must however be taken with this kind of graph.
In a classic filled map, tableau adjusts the size of the geographical polygons to the map scale, which it doesn’t do for the hexagons. To avoid the following disaster, remember that few things when you design a Hexamap:
- The dashboard must be fixed sized. Automatic sized dashboards will shrink the size of your map on smaller screens.
- Fix the map at the best scale for your viz and hide the “pan and zoom”, “Map search” and “view toolbar” options from the map menu.
Now you know everything about building an Hexamap with Tableau