This post was originally written by Shaun Davis.
I love hex maps, plain and simple. They look great and are a good solution to the problems created by representing a measure using the land mass of a state. There’s been solutions shown by a veritable who’s who of Tableau leaders. My method uses the excel workbook from Matt Chambers’ post. All of these methods rely on blending with an excel table which specifies the location of the map tiles. It works well in most every situation, but why not just integrate it in the data using a calculated field? The following steps will allow you to create a hex map without using Data Blending.
Step 1: Create the Calculated Fields
Create a calculated field named Row using the State field.
CASE [State]
WHEN 'Alabama' THEN 6
WHEN 'Alaska' THEN 0
WHEN 'Arizona' THEN 5
WHEN 'Arkansas' THEN 5
WHEN 'California' THEN 5
WHEN 'Colorado' THEN 4
WHEN 'Connecticut' THEN 3
WHEN 'Delaware' THEN 4
WHEN 'District of Columbia' THEN 5
WHEN 'Florida' THEN 8
WHEN 'Georgia' THEN 7
WHEN 'Hawaii' THEN 8
WHEN 'Idaho' THEN 3
WHEN 'Illinois' THEN 3
WHEN 'Indiana' THEN 3
WHEN 'Iowa' THEN 3
WHEN 'Kansas' THEN 5
WHEN 'Kentucky' THEN 4
WHEN 'Louisiana' THEN 6
WHEN 'Maine' THEN 0
WHEN 'Maryland' THEN 4
WHEN 'Massachusetts' THEN 2
WHEN 'Michigan' THEN 2
WHEN 'Minnesota' THEN 2
WHEN 'Mississippi' THEN 6
WHEN 'Missouri' THEN 4
WHEN 'Montana' THEN 2
WHEN 'Nebraska' THEN 4
WHEN 'Nevada' THEN 4
WHEN 'New Hampshire' THEN 1
WHEN 'New Jersey' THEN 3
WHEN 'New Mexico' THEN 6
WHEN 'New York' THEN 2
WHEN 'North Carolina' THEN 5
WHEN 'North Dakota' THEN 2
WHEN 'Ohio' THEN 3
WHEN 'Oklahoma' THEN 6
WHEN 'Oregon' THEN 4
WHEN 'Pennsylvania' THEN 3
WHEN 'Rhode Island' THEN 2
WHEN 'South Carolina' THEN 6
WHEN 'South Dakota' THEN 3
WHEN 'Tennessee' THEN 5
WHEN 'Texas' THEN 7
WHEN 'Utah' THEN 5
WHEN 'Vermont' THEN 1
WHEN 'Virginia' THEN 5
WHEN 'Washington' THEN 2
WHEN 'West Virginia' THEN 4
WHEN 'Wisconsin' THEN 2
WHEN 'Wyoming' THEN 3
END
Create a calculated field named Column using the following formula
CASE [State]
WHEN 'Alabama' THEN 7.5
WHEN 'Alaska' THEN 0.5
WHEN 'Arizona' THEN 3
WHEN 'Arkansas' THEN 6
WHEN 'California' THEN 2
WHEN 'Colorado' THEN 3.5
WHEN 'Connecticut' THEN 11
WHEN 'Delaware' THEN 9.5
WHEN 'District of Columbia' THEN 12
WHEN 'Florida' THEN 8.5
WHEN 'Georgia' THEN 8
WHEN 'Hawaii' THEN 0.5
WHEN 'Idaho' THEN 2
WHEN 'Illinois' THEN 6
WHEN 'Indiana' THEN 7
WHEN 'Iowa' THEN 5
WHEN 'Kansas' THEN 5
WHEN 'Kentucky' THEN 6.5
WHEN 'Louisiana' THEN 5.5
WHEN 'Maine' THEN 11.5
WHEN 'Maryland' THEN 8.5
WHEN 'Massachusetts' THEN 10.5
WHEN 'Michigan' THEN 7.5
WHEN 'Minnesota' THEN 4.5
WHEN 'Mississippi' THEN 6.5
WHEN 'Missouri' THEN 5.5
WHEN 'Montana' THEN 2.5
WHEN 'Nebraska' THEN 4.5
WHEN 'Nevada' THEN 2.5
WHEN 'New Hampshire' THEN 11
WHEN 'New Jersey' THEN 10
WHEN 'New Mexico' THEN 3.5
WHEN 'New York' THEN 9.5
WHEN 'North Carolina' THEN 9
WHEN 'North Dakota' THEN 3.5
WHEN 'Ohio' THEN 8
WHEN 'Oklahoma' THEN 4.5
WHEN 'Oregon' THEN 1.5
WHEN 'Pennsylvania' THEN 9
WHEN 'Rhode Island' THEN 11.5
WHEN 'South Carolina' THEN 8.5
WHEN 'South Dakota' THEN 4
WHEN 'Tennessee' THEN 7
WHEN 'Texas' THEN 4
WHEN 'Utah' THEN 4
WHEN 'Vermont' THEN 10
WHEN 'Virginia' THEN 8
WHEN 'Washington' THEN 1.5
WHEN 'West Virginia' THEN 7.5
WHEN 'Wisconsin' THEN 5.5
WHEN 'Wyoming' THEN 3
END
Create a calculated field named State – Abbreviation using the following formula
CASE [State]
WHEN 'Alabama' THEN 'AL'
WHEN 'Alaska' THEN 'AK'
WHEN 'Arizona' THEN 'AZ'
WHEN 'Arkansas' THEN 'AR'
WHEN 'California' THEN 'CA'
WHEN 'Colorado' THEN 'CO'
WHEN 'Connecticut' THEN 'CT'
WHEN 'Delaware' THEN 'DE'
WHEN 'District of Columbia' THEN 'DC'
WHEN 'Florida' THEN 'FL'
WHEN 'Georgia' THEN 'GA'
WHEN 'Hawaii' THEN 'HI'
WHEN 'Idaho' THEN 'ID'
WHEN 'Illinois' THEN 'IL'
WHEN 'Indiana' THEN 'IN'
WHEN 'Iowa' THEN 'IA'
WHEN 'Kansas' THEN 'KS'
WHEN 'Kentucky' THEN 'KY'
WHEN 'Louisiana' THEN 'LA'
WHEN 'Maine' THEN 'ME'
WHEN 'Maryland' THEN 'MD'
WHEN 'Massachusetts' THEN 'MA'
WHEN 'Michigan' THEN 'MI'
WHEN 'Minnesota' THEN 'MN'
WHEN 'Mississippi' THEN 'MS'
WHEN 'Missouri' THEN 'MO'
WHEN 'Montana' THEN 'MT'
WHEN 'Nebraska' THEN 'NE'
WHEN 'Nevada' THEN 'NV'
WHEN 'New Hampshire' THEN 'NH'
WHEN 'New Jersey' THEN 'NJ'
WHEN 'New Mexico' THEN 'NM'
WHEN 'New York' THEN 'NY'
WHEN 'North Carolina' THEN 'NC'
WHEN 'North Dakota' THEN 'ND'
WHEN 'Ohio' THEN 'OH'
WHEN 'Oklahoma' THEN 'OK'
WHEN 'Oregon' THEN 'OR'
WHEN 'Pennsylvania' THEN 'PA'
WHEN 'Rhode Island' THEN 'RI'
WHEN 'South Carolina' THEN 'SC'
WHEN 'South Dakota' THEN 'SD'
WHEN 'Tennessee' THEN 'TN'
WHEN 'Texas' THEN 'TX'
WHEN 'Utah' THEN 'UT'
WHEN 'Vermont' THEN 'VT'
WHEN 'Virginia' THEN 'VA'
WHEN 'Washington' THEN 'WA'
WHEN 'West Virginia' THEN 'WV'
WHEN 'Wisconsin' THEN 'WI'
WHEN 'Wyoming' THEN 'WY'
END
Step 2: Build the Map
Place Row on the rows shelf and change it to a continuous dimension.
Reverse the Row Axis
Place Column on the Columns shelf and change it to a Continuous Dimension
Load the custom hex map shape. Check out Matt’s post for where to get the shapes and how to load it.
Place State – Abbreviation on label.
Select the option to allow the label to overlap other marks.
Set alignment to Middle Center.
Set the label color to contrast the symbol color.
Hide the Column and Row headers.
Select the sheet formatting options to Format Lines and select None for the Sheet’s Grid and Zero Lines.
Create a Dashboard and add the Hex Map sheet to it.
Do you have more questions about Tableau? Talk to our expert consultants today and have all your questions answered!