### How To: Game of Thrones Analysis Viz

I don't usually write "how to" posts because me no write so good and I would rather spend 20 hours making a viz than 1 hour writing about it. But after reading Chris Love's great post on Tableau "edge-cases" I decided that it might be helpful to explain how I created the Game of Thrones viz which is somewhat of an "edge-case". So hopefully this is helpful.

why even make this? get a hobby
Usually the reason I create a viz is because I want to tell a cool story with an interesting dataset. For me a viz is usually a bit of a chicken or the egg type of situation as in which comes first the data or the story? Do you have a cool data set and find the good story in there; like in this Trump tweets viz? Or do you have an interesting hypothesis and find the data; like in this White House gender pay gap viz?

But sometimes I just want to make some stupid thing that looks cool. This is why I made the GOT viz. Actually, I drew this image below one day on the metro and then thought how could I make this into a viz:

how did you make this? seriously try golf
I have recently noticed that designers that I admire tend to work with simple shapes like circles and triangles. And I had done some custom circle stuff in Tableau before. But these were all pretty straightforward. The trick of this viz is the little doohickey, flipped up circle thing at the top left quadrant. It actually kind of looks like the profile of Wilson the volleyball, Tom Hanks' love interest in Cast Away.

The Wilson volleyball/spiral chart is the only really tricky part of this viz. The bulk of the GOT viz is comprised of 3 parts: a bar chart showing total appearances (green below), a stacked bar chart showing characters by sigil (blue below) and the custom spiral chart showing each character over time by sigil and number of appearances (red below). This "how to" is going to focus on the custom spiral chart since the rest of the viz is pretty straightforward.

Any custom shape or image can be created in Tableau if you properly 1) plot and 2) connect points. To plot the points requires a little bit of geometry. So, to create the spiral I need to structure the points in Excel. Essentially I want a circle for every major GOT characters. In order to create these circles I needed points along the circumference which would be my X (column shelf in Tableau) and Y (row) coordinates. These X and Y coordinates were created with the following parametric equation in Excel:

• X1 = SQRT(2) × SIN(A1 × PI() / 180)
• Y1 = SQRT(2) × COS(A1 × PI() / 180)
Where A represents an angle between 0 and 360 at intervals of 5.4 degrees. The reason for intervals of 5.4 degrees is because I want 50 points or one for each of episode of GOT from angles 0 to 270 (on a clock face from 12 to 9) which is 75% of the circle. To calculate the interval angle I use the following formula:

(360 × 0.75) / 50 = 270/50 = 5.4

So I then have a total of 68 points on the circle (360/5.4 plus one point at zero). So in Excel I then have 1,428 rows of data or 68 points times 21 characters. Here is a link to the Excel file.

But wait there's more... math that is. Sorry. This formula only gives me a circle. Not my beautiful/Wilson the friendly volleyball image that I drew. So essentially I need to duplicate the curve of the lower left quadrant of the circle (from degrees 180 to 270) in the upper left quadrant (degrees 270 to 360) so it curves upward like the reeds sticking out of Wilson's fake head. See the angles labeled below.

So from angle 270 to 360 I duplicate the parametric equation of the lower left quadrant. Then, in Tableau I use calculated fields to re-position the points (via addition) to align the bottom of the arc with degree 0 at the top of the circle, like so...

Then I have to create the concentric circle points for each of the characters. I do that by multiplying the points by an ID value for each character (e.g. Ned Stark is 1, Catelyn Stark is 2, etc). I also add an extra space between each sigil or family group. So now we have our points plotted in concentric circles for each character.

But obviously this looks like shit. So we need convert this to a line but the line needs a path. However, we can't use the angle degree as a path because that starts at the top of the initial circle whereas we want our line to start at the top of the curve. So in Excel I create a path ID field where 1 starts at degree 360, goes backwards until degree 275, then continues on from degree 0 to 270. See the path ID field below.

So with my points plotted and my path field created, I change the chart to a line chart. I place my path ID field on the Path shelf. And now I have this. We are close now.

All that is left is to doll this up a bit. Truncate the axes to remove extraneous white space. Remove the axes labels and gridlines. Change the background to dark grey (almost black). I create a color field which colors the line by sigil unless the character has died in which case the color is the same dark grey as the background.

Then I add a dual axes to plot shapes for when characters debut or die. I do this by creating IF THEN statements that plot the X and Y coordinates for specific characters and episodes. Then I add data labels to highlight these shapes.

Finally I added a measure to the size shelf to modify the line thickness based on the number of appearances by character for every episode.

All that is left to do is to drop in the other elements. Add additional floating charts, text boxes, parameters, and data labels. Then add in action filters and highlights.

in conclusion
This viz took me about 10 hours to create from scraping the data to structuring it and finally creating the viz in Tableau. The trickiest part was the math. I hope this how to was helpful and clear. Please let me know if you have any questions in the comments section. Thank you.

1. Excellent stuff, Adam. I totally hear you when you say the viz creation work is more fun than the write up (and a good blog post NEVER takes just an hour!). However, this is excellent stuff and I really appreciate you writing it up.

1. Thanks Andy. Yes I think this post took about as long as the viz itself. But glad people liked it.

2. This is really a great Write up .If possible could you please share the excel sheet as well. Also my Little brain is facing difficulties in understaing two of the techniques which you mentioned.
1)270 to 360 I duplicate the parametric equation of the lower left quadrant. Then, in Tableau I use calculated fields to re-position the points (via addition) to align the

1. Thanks Rajeev. Just posted a link to the Excel file in the post above. Hope that helps.

2. Could u also help me in understand the below statement.
270 to 360 I duplicate the parametric equation of the lower left quadrant. Then, in Tableau I use calculated fields to re-position the points (via addition) to align the

3. This is amazing. Well done sir. You are truly a data viz great! Oddly enough, I do data visualization full-time and have never really thought of using geometry to make custom shape transformations to my data. So dumb, now it is just so obvious. Typically the simple Tufte approach works, but this really takes it to the next level. I will be brushing up on that stuff for sure. Mind <- Blown

4. This is great. One of the best Tableau Viz. It seem so seamless and smooth. Is it possible to make only the circle with less numbers, since I would like to do a circle shape 10 different numbers turned into shapes on Mark Card. Thanks.

1. Thank you. You could do less numbers to create the circle. You would just change the angle. So 360/10 or an angle of 36 instead of 5.4 above. But the circle would look a little box-ey since the line doesn't smooth around the circle. It just appears smooth with the more points you have. Hope this help. Thanks again. -Adam

5. Thank you for your reply. Fortunately I won't be using lines to connect dots shapes and use as buttons.

1. Sorry for different account name. Matjaz

6. I did it. How to manipulate custom shape properties by size? If you have Tableau default shapes you can manipulate size by moving a cursor switch from left to right. If you do this by custom shapes you get very small objects and resulting size manipulation very crisp/pixelated shapes. Is there a shortcut to a better solution? Different file format? Tableau doesn't support svg format, as I have already tried. Thanks. Matjaz

7. What's your data source for character appearances?

8. Well I did size of image 250x250 px (72 dpi, png format) and it works well almost vector based resolution.

9. I use a lot of pictograms in my visualizations so in the same matter I shall be able to put numbers into different shapes, replacing numbers into custom shapes. Thanks again.

10. Apex Vitality Enhance XL search for the best fat burning sporting Apex Vitality Enhance XLevents. whilst appearing physical activities, you need to keep in mind that the important thing toward getting the most perfect effects is to make sure which you paintings as difficult as possible so that you can maintain increasing your calorie deficit. this may be a large help in breaking down the saved fats inside your frame. most of the nice sporting activities which can be designed that will help you dispose of male stomach fat are swimming, walking, on foot, cycling, dance workout routines, full frame exercises, martial arts, compound weight education and extensive interval schooling. whilst acting those exercises, you need to make certain which you sweat excessively. This is a good way to take away all excess fat which are saved around your stomach.For more ==== >>>>>> http://www.strongtesterone.com/apex-vitality-enhance-xl/

11. Juvalux Anti Aging Cream less significant and facilitates skin to Juvalux Anti Aging Creamappear smoother, it additionally improves skin elasticity and suppleness, improves pores and skin tone and gets rid of dry, scaly or hard pores and skin. This thrilling additive consists of fatty acids which save you drying, cracking, wrinkling and burning of the skin further to supporting within the regeneration and restoration of damaged pores and skin.For more ==== >>>>>> http://www.skinshining.com/juvalux-anti-aging-cream/

12. Hi Adam - I am fairly new user to Tableau and the community. To be honest I thought it was just analytics software and was using it that way, but when I came across your viz I was just blown away and fell in love with Tableau. I have this printed out and laying on my desk and have used this multiple times to show the leadership at my company the power of Tableau. It is such an amazing piece of art and an inspiration to me - ever since I found this (a few months ago) I have been spending every free minute I have at work learning Tableau and hope to make something like this one day. It is simply beautiful - and I have never even seen Game of Thrones. I would be really interested to hear how you came to be such a master. I am watching every training video online that I can find but am still struggling somewhat with the basic formulas. Any advice would be appreciated on a learning path. Thanks, Kerry

13. Hi Adam- as everyone I am awestruck and motivated seeing this visualization.

I am trying to replicate and understand the math behind and so far been successful. However, I am stuck at
" need to duplicate the curve of the lower left quadrant of the circle (from degrees 180 to 270) in the upper left quadrant (degrees 270 to 360) "

Could you please elaborate more how to achieve this ?

14. This comment has been removed by the author.

15. very informative blog and useful article thank you for sharing with us , keep