# Holy Non-Standard Visualizations Batman! (Guest Post)

Hello everyone! My name is Adolfo Hernandez, I’m a Data Visualization and Tableau geek (my Tableau Public profile here). I’ve been kindly invited by Ken to write this guest blog post about how to create the POW chart. This is my first blog post ever and I’m very excited about it, thanks Ken!

Some weeks ago, I contacted Ken because I created my Makeover Monday visualization based on his blog post on how to create a circle shape on Tableau (you can read it here), but I wanted to add a reference line to a series of points that were drawn with a circle shape. I had something like this:

And wanted something like this:

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.

**Data Prep**

The first step is to prepare our data. The shape of the data given in this challenge was like this:

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!

**Visualizing It**

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.

Now we will follow pretty much straightforward the wonderful blog post by Ken, Beyond "Show Me" Part 2:Trigonometry. We will just replace some content of the calculations to adapt it to our data.

**Calculations**

For the Radius we will use the [Index] variable of each country as follows:

[Radius]

MEDIAN([Index])

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 year—I used an LOD to take into account if a different number of countries were present each year:

[Point Spacing]

360/{ FIXED [Year]: COUNTD([Countries])}

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):

[Angle]

([Country ID]-1)*[Point Spacing]

[Angle in Radians]

RADIANS([Angle])

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:

[X axis]

COS([Angle in Radians]) * [Index]

[Y axis]

SIN([Angle in Radians]) * [Index]

OK, we’re done with the data prep and the calculations, now up to the fun part, to draw our POWs!

**Vizzing Up!**

1. Drop [Year] on the Filters card, change it to discrete and select years: 1990, 1995, 2000, 2005, 2010 and 2015.

2. Drop [Year] on the Columns shelf.

3. Drop [Type of Freedom] on the Rows shelf.

4. Drop [Country ID] on the Detail card.

5. Drop [X axis] on the columns shelf.

6. Drop [Y axis] on the rows shelf.

You’ll get something like this:

Change your chart type to Line and you’ll get this:

Now move the [Country ID] pill from the Detail card to the Path card and done!

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:

I selected Orange-Blue-White Diverging. Finally, change the workbook background to black, do some cleanup and formatting here and there, and finally we have our POW chart!

Do you like it? Please leave your comments below and let me see your creations by tagging me either on LinkedIn or Twitter, I want to see what you come up with!

Thanks again to Ken for inviting me to this guest blog post, for the guidance and patience and most of all for his encouragement and support, THANKS KEN!

## No comments: