I hope everyone is looking forward to the Tableau conference. What a great time to come together. I am so excited!
I have the pleasure of hosting some 1 on 1 brain-dates during the three allotted days, so wanted to say a special thank you to all those who are getting involved. I never thought I’d be able to connect with people from all around the world. Cool huh.
Why do I mention my brain-dates? They are specifically on how to use non conform chart types, which ties nicely into this short series on polygons.
Polygon V002: How to frame and size your polygons.
Each blog, I will link some interesting artwork from the data visualisation community and showcase a small snippet of how a similar effect can be done within Tableau. None of the visualisations I produce will be considered fully complete, just half-baked ideas, that I hope help others think differently about design.
This blogs inspiration is Zach Bowders – Tableau Zen Master, who many of you will already be aware of and hugely admire.
It’s always a pleasure chatting with Zach. I secretly learn a lot from him – mostly Tableau stuff (but occasionally random facts to do with America). He is always willing to help people in the community to talk through new ideas, and kindly went through my original polygons blog with me.
For this tutorial you can download the workbook and my dataset. Although inspiration comes from Zach’s work you will see if you download his workbook that he uses a different methodology. Zach’s methodology is probably the right one for what he was trying to achieve but it worked so well for what I wanted to cover in terms of polygons.
Before we start, I’d just like to make sure readers are aware Zach has allowed me to reference his viz in greater detail.
I’ve taken Zach’s original data and added in an extra shapes tab. If you’d like to follow along, join the data like this:
Prepping the data can be tricky for things like this. We take the original franchise data (the dataset that has some co-ordinates to plot) and left join to it the ‘data join tab’. This in effect is joining all the different sub-categories for each franchise. As we are joining franchise to franchise. The reason for this means all the points for each film we then plot will be split out for each franchise.
The next thing we do is join a shape file to the Franchise data with a join of 1 to 1. This means that for each film, we want to have our shape (4 points for a diamond)
One key ingredient to using custom polygons in this fashion is knowing what it’ll look like plotted, and how much room it will take up. Normally with a lot of small multiple ideas and newer map layer ideas you tend to see community members build each block in 1×1. Not always, but it makes life a little easier to think about.
In fact, Zach’s piece above is a perfect example of that.
Here are those same points re-created in Tableau.
What polygon shape you will use?
What is the size of the polygon shape?
To rebuild Zach’s Viz using polygons you could create four points of (0,0.5) (0.5,0) (0-0.5) (-0.5,0) for a diamond, and draw a path between them. This is my thought process behind each diamond spanning 0.5 each way, total length and height of 1 in total.
Of course then it may need to scale them all slightly when plotting them to make sure there is no overlap.
A couple of things with this method is fixed axis work in your favour. When you have square shapes you’ll want the axis to be the same for both x and y. (same goes for using circular points)
JOINING SHAPE FILE
Above we take the original points and offset them in the 4 directions by the co-ordinates I mention above. You will see how this is done in calculation 001 and 002.
Here’s me realising the diamonds are nowhere near large enough, so I add in a resize parameter.
Check X 003 and Y 004 – you will see something like:
[X]+ ([X (Shape)]*[Resize])
What does this mean?
Take our original x and y co-ordinates for the centre point of each diamond from the original data.
From this we offset the 4 points of our diamond from that centre by the co-ordinates I listed above.
Realising these co-ordinates were too small I added a value that we multiply to the 4 offset points to be able to evenly expand them away from their original centre.
Of course, Zach’s work is simply a reference point where I’ve created a shape file of 4 co-ordinates for a polygon. (5 for the line)
In fact, polygon blog 001 showed how we converted our points into a circle.
Realistically you can create a shape of any kind:
I’ve attached a few starting co-ordinates I think are useful for various shapes, here!
In it you have access to:
A semi-circle, Diamond, Square and petal.
BUT WHAT ABOUT LINES?
Line paths and polygon paths work differently. Polygon paths will join up your start and end position naturally as it wants to fill in the blank area. Line paths don’t work this way because… well its a line. If you want to connect the points your start point and end point would be the same.
For example in the case of the above rather than having the four co-ordinates mentioned previous you will have:
Here is an example of those 5 path points joined as a line within our dataset. Note how we have the X and Y on detail as we separate each diamond out based on these points.
To finish my awful cloning of Zach’s style and achieve the inner shapes, I would further amend multiple of these diamonds based on a proportional sizing to the maximum. The easiest thing to do is to have a column between 0 and 1 that you multiply by. 1 is the maximum size, everything else acting as a percentage (portion) of that. As the original data is a score of 100 we can just divide it by 100.
Here’s my final stab at it.
The visual output differs slightly to Zach’s where I have proportionally sized all the squares relative to one another. I have also removed all the zero records. You’ll see a major downfall of my version is that anything with a score less than 20 becomes practically impossible to read. You’ll also notice how my version has zero as zero. If you use the shape method, obviously the shape itself accounts for something, that’s why Zach’s spread in lower numbers looks much nicer.
So again, I leave here a little preemptively, at a stage of ‘CJ you’ve given me shape files and a few sizing tips but what now?’
With the learnings I hope it spurs a moment of creativity – one where you can start applying it to your own work.
Things to remember:
- Yes, this isn’t best practice charts. Yes, A little harder to understand compared to other charts. BUT, still make sure it is interpretable what you are trying to show. Weird, wacky and wonderful is great and I’m all for it, but be cautious how you use it.
- There are alternative methods that you can use to polygons such as shapes. Consider what is most appropriate. Think about data densification (size of data sheet), think about readability, think about trade offs in tooltips. Pretty much, weigh up some of the pro’s and cons of different techniques.
In summary, Probably best to just use the size mark like Zach. This was so unnecessary ha.
As always, Let me know your thoughts. I can be reached on Twitter, @_CJMayes.
The last of this small series Polygon V003 will look at multiple layers, dashed effects and line paths.