Logo

The Data Daily

Holy Non-Standard Visualizations Batman! (Guest Post)

Holy Non-Standard Visualizations Batman! (Guest Post)

We couldn’t find an elegant solution for this, so the idea was dropped—if you have any ideas, please let us know! Then Ken suggested that I modify one little thing—change the data points from dots to lines and the result was this:

We both agreed that it looked pretty cool so I finished my viz following this idea. Ken come up with the name of POW chart as it resembles the famous POW letters from the 1960s Batman TV series:

I posted my viz on LinkedIn and several data lovers were asking for a tutorial on how to construct this viz, so here we are and this is how it’s done.

But we need to pivot it so we can work with it, giving it a long format like this. I used Excel (Power Query) but you can use Tableau for this part, your choice:

Also, we’ll need a helper dataset, this will come handy when we create the viz. I just copied the “countries” column to a new sheet, removed the duplicates, and inserted an “Country ID” column that goes from 1 to 159—the total number of different countries in our dataset. This data will be later used to draw the circular shape in our POW chart.

Maybe all this data prep could have been done in Tableau by using calculations but I’m more inclined to understanding what I’m doing, even if there are more steps involved, over elegance in the code. If you know how to do all these steps in Tableau please do so and share!

This “POW” chart is basically a circle shape formed by the quantity of [Countries] we have in our data (159 points), and each point has a different radius length that is given by the [Index] variable, this variation on the radius give us the POW effect. By the way, when I mention Index I am referring to the score each country gets on the Type of Freedom, which is the study case of this particular dataset, I’m NOT referring to Tableau’s INDEX() function so be careful not to get confused by this.

First we load our Excel file in Tableau and make a Left Join using our main dataset and our helper dataset. Now you should have two extra columns the “Country ID” column and the “countries (Sheet 2)” column. Hide this last one to avoid variable cluttering. NOTE: An inner join would have worked to but I wanted to prevent the filtering side effect that inner joins might cause.

Next, we calculate our point spacing. This will be determined by the number of total [Countries] we have. Basically we are spreading out uniformly the points along the perimeter of the circle shape. A circle contains 360 degrees and we want equidistant points so we divide 360 by the number of countries we have each yearI used an LOD to take into account if a different number of countries were present each year:

Now we will calculate the angle. What this formula does is sequentially add the degrees we need on each point (country) by following the point spacing we calculated and starting at 0. To do this, we will use the [Country ID] variable from our helper data set (remember when I told you we will need it?). Then we will transform this calculation to radians (cosine and sine functions in Tableau need radians not degrees):

Almost there...now we need to calculate our (x, y) values for each point (country) that will form our circle-POW shape. These values are calculated by multiplying the [Index] variable (hypotenuse) of each country by the Cosine and Sine of the [Angle in Radians] of each country like this:

To give it the divergent color effect to the line, drop the [Index] variable in the Color card, change the measure from SUM to MEDIAN and then double-click in the Index color card that appears in the top-right corner of your screen and select one of the Palette options that are displayed:

Images Powered by Shutterstock