Radial Tab Polygon Chart

TL;DR – If you want to get straight to the how-to, then scroll down a bit until you see “The Radial Tab Polygon Chart” header section.

Radial Chart Background

I’m a big believer that radial charts, of any kind, should be used with great caution. The reason for this is that while we have a natural attraction to circles and spherical objects, they are more challenging to comprehend when we add data into the mix.

Manuel Lima, author of The Book of Circles: Visualizing Spheres of Knowledge, explains how our love of circles stems from both historical and evolutionary origins (he has an amazing article that you should read here. Three of the oldest archetypes of the circle are the spiral, concentric circles, and sectioned circles, and these figures were drawn by prehistoric humans all over the world. That means that the connection to the circle wasn’t limited to one culture or one area of the world.

In fact, throughout civilization, the circle has represented key images in our world: the sun, the cycle of life, the four quadrants of the seasons, the earth, the womb, and even direction (a compass). Let’s not forget one of the most fundamental discoveries for early humans: the wheel! Circles evoke plenty of warm, fuzzy feelings clearly because we have a lot of historical and biological connection to them. Circles are found throughout nature: berries, urchins, rings of water, a dandelion full of seeds, a tree stump. Sharper shapes, such as squares, are harder to find in the natural world.

Screen Shot 2019-12-04 at 3.09.59 PM.png

So why bring this up? Because sometimes what we love is not always the best for us. In the case of data visualization, circles are challenging to interpret. However, that doesn’t meant that there isn’t a use for them at times and it certainly doesn’t mean you shouldn’t try to learn how to use them.

I’m also a big believer in learning as many skills as you can because you never know how you can use that skill in, perhaps, a different way than the original intent.

My good friend, Kevin Flerlage, wrote a fantastic blog about the radial bar chart and also did a talk with his brother, Ken Flerlage, at the 2019 Tableau Conference that shows how to create them.

Radial charts can be used to show some variable over time, as we think of time in both a linear and circular manner (the hands on the clock go around in a circle, days turn into nights that turn into days, seasons cycle, etc). Radial charts are also useful to draw attention and make a statement. Since we are naturally drawn to them, we are therefore quite curious when we see one and want to look at the visual in more detail. Lastly, radial charts can be useful for spatial purposes. Sometimes you can find more around a circle than you can in a straight line.

Variations

As with most charts, there can be variations. Just look at this assortment of recently published radial charts on Tableau Public – all with a different take on the chart type.

In fact, one of my earlier vizzes was a radial chart (of sorts). You can reference my blog post about how to create it as well.

The Cycle of Influenza
Lindsay Betzendahl

With different variations comes different approaches, calculations, and techniques. There are many blog posts out there on how to create these variations so I won’t claim to be the only one. However, I am going to share a method to create one type of radial chart – what I’m calling the Radial Tab Polygon Chart, or the Radial Tab Chart for short. Yes, we are going to use polygons. But don’t worry, I promise, this method only have a few steps and shouldn’t be too overwhelming.

The Visualization

November’s #ProjectHealthViz data was on prostate cancer – a very common type of cancer but one that comes with many side effects that aren’t typically discussed. I’ll save it for another post, but I was very motivated to make a visual that told the right story and communicated the untold information about prostate cancer. During my brainstorming process, I stumbled across the idea of juxtapositioning art with reality. In my quest to find the right visual, I thought about the Vitruvian Man, a drawing by Leonardo da Vinci. The sketch is that of a man, which appears to have four arm and four legs. However, the meaning is much deeper than that.

Regardless, the point of the blog is about how to create the chart. So let me get to that. What I knew I needed was to create a circle around the man and that the circle was what would convey my data points. In this visual, the data was individual state rates (incidence or mortality depending on the parameter value chosen).

You can see and interact with the viz here.

You Are Perfect_Prostate Cancer_Vitruvian Man.png
Lindsay Betzendahl

Originally, I started with an alternative to my final approach. A donut chart!

The Donut Chart Alternative

To make a donut chart where each slice is the same width (to give us that ‘tab’ look), you simply need to make a pie chart where the angle is based on the count distinct of your dimension.

Using Tableau’s SuperStore data set, we can create this ‘tab’ radial chart.

We need to make a pie chart, but because each slice needs to be the same size to get that ‘tab’ look, we will put the count distinct of our dimension (State) on the angl, the measure (Profit) on the color, and the dimension (State) on detail.

The result should be this:

Screen Shot 2019-12-04 at 3.59.21 PM

The next step would be to make the donut. To do this we just type directly into the Rows Shelf the following: MIN(0). Then Ctrl drag that green pill over to duplicate it (or type it out again) and you will have two identical charts on axis lined up vertically.

Screen Shot 2019-12-04 at 4.01.13 PM.png

The last step is to remove all the fields from the marks card for the lower pie chart and change the color to white and make it slightly smaller than the top one. Then select ‘Dual Axis’ by right clicking on one of the axes and then set them to be synchronized. After cleaning up the formatting and removing lines, you will have a chart similar to my original.

Screen Shot 2019-12-04 at 4.04.50 PM.png

There are a few limitations to the donut chart here. First, when you hover or select, your user sees the full pie. Secondly, using the size marks card can be very finicky and difficult to get the exact sizes that you want.

Screen Shot 2019-12-04 at 4.05.45 PM

In the end, I opted for the polygon alternative, which actually wasn’t as hard as it sounds and made my viz much more flexible. So let’s get to it!

The Radial Tab Polygon Chart

A polygon in Tableau is simply connected points on a grid that form a closed shape. To create what I was going for, I needed four coordinates for each section. You actually can see this from the original donut chart example. I needed to calculate those four points for each tab of my radial chart.

Screen Shot 2019-12-04 at 4.29.39 PM.png

Creating a polygon in Tableau requires a few core things:

  1. Path Order – tells Tableau how (in what order) to connect the dots to make the shape
  2. Shape ID – distinguishes one set of coordinates from another to create individual shapes

Since my data set didn’t naturally come with these (and neither does SuperStore) we will need to create this using what we have.

Step 1 – Duplicate your data to create your Path Order field

In the Data Source window, union 3 additional copies of your data sheet into the data view. You will get a union that looks like this:

Screen Shot 2019-12-04 at 4.34.18 PM.png

(Note: An alternative would be to create a separate table with one column called Path Order and the values 1-4 and join the tables using a custom calculation of 1=1. I opted to keep everything within the data set I was using as that was easiest when I was working on the fly. Both methods duplicate your data.)

Tableau will automatically create a field named “Table Name” which will be the source for our Path Order calculation.

Screen Shot 2019-12-04 at 4.36.48 PM.png

This calculation gives us four points by which we now can create our polygons. But how do we know where we want to plot these coordinates?

Well, our work with the donut chart will give us a good idea.

Screen Shot 2019-12-04 at 5.29.22 PM

Step 2 – Make our Parameter Fields

Parameters can help us resize our viz after we’ve created it. This is much easier to do with the polygon method than the donut. Additionally, we can add a spacing feature that creates more or less of a gap between each tab.

Here are the parameters to create, all of which use the data type of Float.

  • Radius – Start by making this 10.5
  • Radius2 – Start by setting this to 1.5
  • Spacing – Start by setting this to 0.05

Step 3 – Create Calculations for our Coordinates

This is probably the hardest part of this whole build so stick with me.

  • Index – INDEX()
  • Angle – 360/{FIXED :COUNTD(State)}

These first two are simple. We will use INDEX() in our Degrees field. Index basically identifies the row number in the partition. For this use, when we have the States alphabetically, Alabama has an Index of 1, Alaska 2, etc. In order to tell the Index calculation to do this, we need to drag out State and Index and set Index to compute using State.

  • Degrees – SUM([Angle])* IF ATTR([Path Order])=1 or ATTR([Path Order])=2 THEN [Index]-[Spacing] else [Index]-1+[Spacing] END

This calculation is adjusting the degrees ever-so-slightly by adding or subtracting the Spacing parameter value. One side of the polygon adds and the other subtracts.

  • Radians – RADIANS([Degrees])

This just changes the Degree calculation to radians so we can use it in the following calculations.

  • Radius – IF MIN([Path Order])=2 or MIN([Path Order])=3 THEN AVG([Radius])+AVG([Radius2]) ELSE AVG([Radius]) END

The Radius calculation is going to use the value in the first parameter if the Path Order is 1 or 4 (which are on the inside of our tab, or the closest to the center) and use the Radius parameter PLUS the Radius 2 parameter if the Path Order is 2 or 3 (the two furthest coordinates). Look back at the image above.

The X and Y coordinates just use all of the above calculations.

  • X – COS([Radians])*[Radius Adj.]
  • Y – SIN([Radians])*[Radius Adj.]

Whew, we did it! Now we know why when I thought of this idea around 9pm while I was in bed, I didn’t finish until 11pm. LOL! Working it all out in my head too a bit of mental flexing, but now I’ve got it all written down for both you AND me! Bonus!

Step 4 – The Radial Tab Polygon Chart

  1. Put X on rows and Y on columns
  2. Add State to the Detail shelf (take off Country)
  3. Change the mark to a Polygon
  4. Place Table Name on the Path card
  5. Put Profit on Color
  6. Adjust the X and Y pills to “Compute Using” State
  7. Change the Sort Order of the Table Name to ensure that they are correct (otherwise you may get a bowtie!) from Order, Order$, Order1, Order2 (use the manual function)

And you should have the viz below!

Screen Shot 2019-12-04 at 6.14.02 PM

Benefits of the Radial Tab Polygon Chart

As I mentioned earlier, the benefits are that you can adjust the spacing and the size of the radius, thus adjusting the look of the chart. For example, by making a larger space between the tabs and by making the second radius larger, I can create a different look.

 

Screen Shot 2019-12-04 at 6.14.12 PM

Additionally, as I did in my viz, I used a background map image to create the man in the viz. This was easier to do with this chart than the donut.

Another fun, and easy adjustment with the Radial Tab Polygon method is that you can also make a semi circle very easily by just adjusting the Angle calculation. Instead of 360, change the calculation to 180/{FIXED :COUNTD(State)}. Adjust the axis and you will have a viz like this:

Screen Shot 2019-12-04 at 6.04.28 PM

I actually used this approach in the collaboration Cheetah viz I did with Kevin Flerlage. In this case, the radial bar chart was my idea to add, but I didn’t have much space left and it was meant to just provide additional information. So I used this method of adjusting the angle to limit the space of the radial chart.

Screen Shot 2019-12-04 at 6.07.53 PM.png

Conclusion

So there you have it! You can find the Tableau viz on my Tableau Public page here if you want to download it and rebuild it.

As always, reach out if you have questions. You can find me on Twitter at @ZenDollData or via my contact page. Let me know if you try this technique and please do share it with me – I’d love to see what people come up with! But remember, there are very specific times this should be used and use it with caution.

Cheers,

Lindsay