2017

October 2017

# Yet still more jittering... spirals on maps

Posted by Sarah Battersby Oct 19, 2017

At special request from Bassem Client and Jonathan Drummey, here is an addendum to my earlier post on ways to jitter points on maps (Jitter Those Points!)…the all-important spiral jittering pattern!

In my original post I provided the basic equations for jittering points in a spiral on a scatterplot:

These are just a calculation of x and y coordinates for points sort of, approximately evenly spaced along an Archimedean Spiral.

What if we want to throw them on a map, instead of a scatterplot?  It turns out to be much easier than I thought it would be… All we need is some minor adjustments to the original calculation:

• Change from using the ‘Value’ field in my scatterplot to a Tableau-generated Index() value (the values were just 1, 2, 3, 4, etc. anyway, so this really isn’t a big change – we’re just letting Tableau do it’s indexing magic for us)
• Add in the latitude and longitude values so that we are shifting points away from the mapped location (instead of away from 0,0 on a scatterplot)
• Add in Radius and Spacing parameters so that it’s easier to control how far apart the points are, and how tight the spiral is – this is super helpful on the map, because the scale of the map and the density of points may look better with a tighter spiral or more distant points.
• Remember to set the table calculation correctly (otherwise, you too can waste precious minutes trying to figure out why the map looks so weird…).  Hmmm, not quite the look that I was going for:

And here are the gory details on my updated method for spiral points on a map:

Set the new Jitter – Spiral – Latitude and Longitude calculated fields to the right geographic role, drop them on a new worksheet – and then make sure your table calculation is correct. Hopefully you’ll end up with some magic:

For me, the hardest part of this is making sure that my index is calculated correctly, so I often make myself a table so that I can look at the index values.  For example, here is the table that I used to make sure that my index was restarting for every zip code.  The ‘Index along ID’ column shows the correct numbering (sequential for every ID, restarting for every zip code).  So, that is what I want to use when I set the table calculation

If you want a more step-by-step, here is the start to finish process to create the map:

1. Create two parameters (radius and spacing). Both are floats, and the spacing parameter should only allow positive values up to 1.
2. Two new calculated fields (Jitter – Spiral – Latitude and Jitter – Spiral – Longitude). The equations are shown earlier in this post, and you can grab them from the attached workbook.
3. Set the calculated fields to the right geographic role (latitude and longitude)
4. Drop the calculated fields onto a worksheet
5. Set the level of detail that you want (I grouped points by Zip Code)
6. Drop the unique ID for the points onto detail to disaggregate (I used the ID field)
7. Adjust the calculation on rows and columns so that they are computed using ID
8. Add the radius and spacing parameters to the viz to refine the spiral-y-ness of your spirals

And you’re good to go!  The attached workbook has all of the calculations.

By date: By tag: