Leader Lines and Labels for Small Map Polygons in Tableau

Leader Lines and Labels for Small Map Polygons in Tableau

I was recently working on a project that required some spatial analysis work with relatively small polygons which made squeezing the labels into the polygons a challenge.

I wanted to figure out a way to both clearly display the label and the associated data and also ensure the selected value was clearly identified geographically. It needed to be dynamic and based off of the user selection, so simply annotating the point would not do.

The good news was this was not a new challenge in the world of mapping and it can be done pretty easily using Tableau’s spatial functions.

Step 1: Get your Lat / Lon’s in the Data Source

Not as generated fields in Tableau, not as geometries within a spatial file, but as integers that you can use in some Tableau Spatial Calc’s; thanks to Steve Fenn for putting this google sheet together. I used this sheet to join to my county level shapefile to produce the datasource.

Once you have your data prepped you can then make your points that you will use for your map label leader line:

Once you have your points, then you can make your line:

makealine.png

Which will be used in place of the GEOMETRY field in your dual axis map:

From there, it’s simply a matter of formatting your line, and adding in the label that you want at the end of the line.

Nothing overly complex or difficult, just a simple way to solve a pretty common mapping challenge thanks to some of Tableau’s spatial functions.

The viz on Tableau Public is linked below:

UPDATE 9/5/2020…

I have also updated the dashboard to include perhaps a more common use case… Ensuring visibility into labels associated with the smaller states along the east coast.

I have created a google drive folder that contains both the US shapefile (albers projection) and an excel file with 2 sets of latitudes and longitudes; one for the state centroids, and the other set (only for the smaller eastern states) with offsetting lats/longs to ensure visibility.

Dear 2021 Iron Viz Finalist ...

Dear 2021 Iron Viz Finalist ...

Reflections on IronViz

Reflections on IronViz