Hi All,

I am seeing more and more creative visualisations each day I sign into Tableau Public, and I LOVE it. I have huge admiration for anyone looking to push themselves in any area of their visualisation, but a small flame is ignited inside me when I see a design that could literally be hung in an art museum.

This will be the first of a series of blog posts that are released to help understand using polygons.

**Polygon V001: **How to build, transform and rotate a shape.

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 weeks inspiration is **Michela Lazzaroni** – who I came across on **Behance**.

You can view Michela’s work, **here.**

Before we start I want to say a massive thank you to **Soha Eleghany**, **Kizley Benedict** and **Mo Wootten** who all generously gave up time to review and go through the polygon series that will be released over the course of November. What a lovely gesture from them – and the feedback was more than valuable.

For this tutorial you can download the workbook and dataset from the top of the page.

**MAKING A CIRCLE**

I make all my circles using the same methodology – I have included it in the workbook for a reference point. Once you are comfortable with the 4 calculations in the workbook lets move on, (the calculations are commented so should be easy to understand).

In short, we create an angle between each point, order them and space them equally, and then use trigonometry to find the x and y point to plot in a radial pattern.

**SEMI CIRCLE**

Join the Data to the half circle tab using a custom join of **1 to 1**. In its simplest terms we have just made 180 points for what was a one row dataset holding just category A in it.

What this join is creating is for each ‘category’ , I.e each individual mark in our dataset – it is creating 180 points. Therefore if I had two categories in my dataset, A and B, I would have 360 points in my dataset. 180 for A, and 180 for B. For those that are unaware, what the join of 1 to 1 here is doing, is joining for each row in the first data tab to every row in the next data tab.

We can build our half circle with the exact same 4 starting calculations as previous. The only calculation that is now different is the Angle. Rather than have our circle as 360 degrees, 180 provides us with a semi-circle.

(You may see in the dataset I’ve reduced the T value, in effect this value can be any number I’ve just reduced the amount as for what we are creating we don’t need it to have lots of points. Each point remains 1 degree apart)

Plotting X against Y gives us our points for a semi-circle.

If we then change the Mark to a polygon it **will automatically join our first and last point together.** We will want to put T onto the path **as it is the order we want the points joined!** (Note: A line path is slightly different)

**ROTATE THE SHAPE**

So how do we rotate our polygon? We must consider the polygon as a bunch of points we want to rotate. (Think about those dots we plotted) Below are the new calculations for x and y.

Yep. Confusing right. **This blog** perfectly explains what these calculations do. You will see they do not differ hugely from the X and Y calculations we previously had. We take those points, and we create two new X and Y co-ordinates that take into account theta (the angle we want to rotate through)

I have created a parameter **P. Angle Rotation.** This parameter is a number between 0 and 360. Therefore if the parameter is 0, we will have rotated the semi circle 0 degrees, 180 it has spun around and 360 it is back to its original rotation. The reason I have included a parameter here is so you can visualise how this works. (**example below shows the semi-circle rotated through 110 degrees**)

(There is a way of re-writing this calculation to be neater, but for the sake of following the blog link I’ve left it like this.)

So these calculations can help us rotate the shape, but only through the origin of (0,0)

**ROTATE THE SHAPE AROUND AN ARBITRARY POINT**

So, as if that wasn’t confusing enough, what if we wanted to rotate our points through a random co-ordinate? For example, I have chosen the point (1,0) that I want to rotate all my points around.

**Calculations 7 and 8** come from the previous blog too.

Here we are accounting for the co-ordinates of the centre of rotation. Have a look in the workbook how changing the angle of rotation now impacts the movement of the shape around the point (1,0). Try changing the numbers of 1 and 0 to different co-ordinates of your choosing and see how that impacts the way it moves.

You will notice that if you make the values (0,0) it is in effect the same calculation as in 5 and 6!

**SCALE THE SHAPE**

Let’s go back to our original X and Y calculations….

How do we make our semi-circle smaller or larger? We simply times our x and y values by a specific amount of **equal value.**

To show how this works, I’ve created a parameter slider of values. **Remember, if you do not multiply by the same constant your shape will be stretched unevenly!**

**TRANSPOSE THE SHAPE**

Transposing the shape, I.e moving the points is by far the easiest to comprehend. We simply add a value to the X and Y co-ordinate to move the points along the axis.

**FLIP THE SHAPE ON ITS AXIS**

The final thing I wanted to cover was how we flip the shape through its axis to simulate reversing the axis. You may consider clicking into the column or row and putting a minus sign in front of the header. This would work, or alternatively you can use a parameter.

I created a custom parameter integer list, once where the value is 1, and once where the value is -1. Multiplying the axis by minus 1 is in effect calling it -axis.

**PUTTING IT INTO PRACTICE**

So now we have covered how to go crazy with one shape!

Below is an example where I’ve played around with multiple shapes and spins to emulate some of **Michela**‘s style, albeit my data is **dummy data.** (showcase data set) I wont go too into the crux of it, but in the dummy dataset you will see some ‘origin’ points creating the grid, and then the same methodology as above for creating the shapes.

You will also see a column called **‘proportion of full’** – this is a hardcoded value I’ve used in order to size some of the semi-circles into random smaller values. The final viz uses the calculation of rotation around the origin (0,0), not an arbitrary point.

**Other resources and inspiration:**

If you are familiar with Path bins I would consider **this tutorial** by Toan Hoang. The reason I have made my run-through not using path bins is because next blog we will be following a similar methodology to today but applying it to new shapes!

When finishing up this blog, I remembered the perfect example of how this style is emulated.

None other than **Neil Richards**. Neil is one of the most creative, talented members of the community. I’d recommend anyone to go dig into this workbook to see the true technical knowledge on show. To revisit my art museum intro – Neil’s work is a prime example.

**Round-up:**

So you may have reached this point and thought, *CJ you’ve just made random semi-circles on a page*. Strictly speaking, you’re correct. But the two main takeaways are firstly and predominantly the technical takeaway of how to manipulate a polygon shape.

More widely, the takeaway is: how can we change our mindset in the way we interact with visualisations that are non-conform? Think about some cool user cases where you could apply this. Could you use the rotation as showing a shift or skew – I like to think of the idea of tipping the balance one way or another of a scoreline. Can you use the relative sizing in an effective manner? Does the shape you choose help reinforce your story?

In the next Polygon blog we will look to build on what we have learnt here in terms of scaling, with a focus on scaling relative to a fixed maximum. We will also cover off how to include more than just one polygon shape.

As always, Let me know how this was to follow. I can be reached on **Twitter**, **@_CJMayes**.

**LOGGING OFF,**

**CJ**