Tableau Polygons 101

Brittany Rosenau
5 min readJul 10, 2024

--

Aka how I learned to draw triangles

It’s July in Central Florida, and it feels too hot and muggy to do anything outside. I’m not the biggest fan of heat-I’m happy in sweater weather, which prompted me to pull the data.

Was it really that hot or was it all in my head?

Spoiler alert: It’s really hot right now.

Inspiration

I had already visualized the 2023 data as a line chart as part of the #30DayChartChallenge, so I wanted to visualize the first half of 2024 in a different way.

At work I had recently made a calendar viz, so I thought that would be a good place to start. I also remembered this split heatmap viz by Sam Parsons, which I thought was eye catching and informative.

https://public.tableau.com/app/profile/sparsonsdataviz/viz/Highlightingtotheedge/Highlightingtotheedge

I wasn’t sure how to achieve this look with shapes, so I thought I’d give polygons a shot. Polygons aren’t a new thing in Tableau at all, but they’re new to me; this seemed like a great chance to learn on an easy shape: triangles.

First thing I did was google “polygons tableau” and a great tutorial by Playfair Data came up.

Building the data sources and data model

To use polygons, you have to create a data set of points that define your shapes using X, Y coordinates.

The x,y coordinates for a triangle are fairly simple:

This shape is made of 3 points, so the data would look like this:

Note: numbering the points is important, because it tells Tableau what order to draw the lines for your shape. If you are making more complex shapes, think about how you’d actually ‘draw’ it.

To get my next shape, I drew out my next triangle and plotted the points:

Looking at a calendar, the max number of days is 7, and the max number of weeks in any month is six, so I expanded my ‘grid’ out to a 6 row, 7 column rectangle, split my triangles, and numbered them 1–84.

This 84 triangle grid would cover any combination of triangles that I would need to build out my month tiles. This sheet in my data source was called “Triangles”.

Next I needed a sheet to map the days of each month to each shape. Each day will have two Shape IDs, shape a for the lower triangle, and shape b for the upper triangle.

January has 31 days, and from my 84 triangle grid, since it starts on Monday of week 1 and ends on Wednesday of week 5, I grabbed the point data for triangles 3–64. I repeated this process for the next months, grabbing the data for each month’s set of triangles.

I knew I wanted to color the lower triangles based on the minimum ‘feels like’ temperature, and the upper triangles on the max ‘feels like’ temperature, so I have a sheet that assigns a temperature to each shape ID.

Later I decided I wanted to bring in my full weather data to add to the viz, so I created a sheet to map the Shape ID to actual dates:

This sheet then lets me relate the full weather data in without any calcs.

I recognize this is not the most efficient way to set up, but I was designing this as I went! The final data model in Tableau looks like this:

Putting it all together in Tableau

Now to actually make the polygons in Tableau —

  1. Make sure your mark type is set to Polygon
  2. Put avg(x) on columns
  3. Put avg(y) on rows
  4. Add Shape ID to detail
  5. Add Point ID to path

I’ve added white borders here — but you can see the triangles!

After that, I played around with colors and formatting. While turbo mode is fun, I decided these colors were wayyyyy to bright for the final cut.

I also realized that while polygons are pretty neat — they don’t allow you to label them directly without any hacks. So I decided to leave them labelless, and include extra information in the tooltips.

Here is the final viz:

https://public.tableau.com/app/profile/brrosenau/viz/TavaresTemperatureTiles/TavaresTemperatureTiles

Want to make your own calendar? I’ve created a viz that has just the 84 tiles that you can download, and you can grab the 84 triangle sheet from data.world. (https://data.world/brosenau/polygons-101-84-triangles-calendar-grid)

https://public.tableau.com/app/profile/brrosenau/viz/84Triangles-Polygon101TemplateandCalendarBase/84Triangles-Polygon101TemplateandCalendarBase

Triangles are probably one of the easiest, if not easiest shape to draw, and there are many folks out there much more experienced at working polygons than I am. If you’d like to learn more, I recommend the following:

More Resources

And of course, I always recommend searching Tableau Public for an endless sea of vizzes to inspire your next great chart.

--

--

Brittany Rosenau

Design Nerd | Analytics Professional | 7x Tableau #VizOfTheDay | Iron Viz Finalist | Tableau Visionary + Public Ambassador