*This post covers the thought process behind creating petal vizzes and the inspirations behind it. Whilst you may not want to create this visualisation directly, hopefully it will detail topics of rotating shapes, creating radial graphs and using map layers. *

Hello!

I am not sure what to call this run-through? Half flower half circle thing? I posted it on twitter only partially finished. It was mainly for experimentation purposes with map layers, but received a fair amount of good reception so have written this blog to explain some of the behind the scenes.

In truth, I’m fairly unhappy with the published dashboard mainly as it has little context and you realistically learn nothing from looking at it at face value. I did however learn a lot in terms of transformations and map layers so felt empowered to post it… one day I may need to steal the calculations out of it. Not every dashboard needs to be a finished work of art after all.

**Reasons why my dashboard doesn’t sit well with me:**

- The petal sizes are hard to cross compare. In fact I picked two different player positions in the vain hope that their attributes would be wildly different but they aren’t!
- The circles (goals) are tough to cross-compare too. They probably could have done with using a different measure type. That’s the problem when you start with mock data of the alphabet and then try substitute in a dataset that doesn’t particularly work well.
- Theoretically it’s probably quite odd too having petal attributes for 2021 only and then the goals are per season for the past 6 years. This probably should be signalled a little clearer with text on the top which way the seasons go.

**Reasons I posted it:**

- Looks quite cool, ha.

Before we start, I must say. You don’t have to look far to recognise the amazing work of **Neil Richards** in the Tableau community. If you want to check out how to utilise flowers in visualisations, check out his blog post **here**.

Neil recently did a **vizconnect** session called Patterns, Polygons and Petals. 20 minutes in he covers off petals, which he used in a **Premier League** visualisation. He goes on to discuss the calculations behind the visualisation and how to rotate the petals, discussing trigonometry in more detail. Naturally, I wanted to give it a go.

In the wider world I have been blown away by the graphics of **Federica Fragapane**. Her work is a thing of beauty. I often sit there scrolling through behance and pinterest thinking where I would to even start to try replicate some of her concepts in Tableau. Check out one of my favourite **here**.

Some worthwhile videos and pre-reading:

Tableau 2020.4: **How to use the new map layers feature** (and go beyond just maps!) – Data Coach

**Lacrosse D1 Championships** – Simon Rowe

**How to Map Any Background Image in Tableau** – Ryan Sleeper

**Geospatial Analysis with Map Layers** – Marc Reid

Luke’s data coach was utilised to understand the layers. Simon covers this off in a written blog too and provides an alternative method to creating a background which may be of interest. Ryans background image was used to add the circular frame having exported my finished sheet as an image and then constructing it to fit my visualisation. Marc’s blog covers off using multiple datasets on a map, which is utilised when prepping the data.

**LOOKING AT THE DATA**

Below I will look to outline the steps and give explanations behind specific decisions.

Here is some **mock data** to get us started. I have also attached the final run-through workbook which is much cleaner than the one I posted on Tableau Public, feel free to download a copy **here**.

This is what we will look to replicate/explain.

There are three sheets within the file. The way we join them together is hugely important.

Sheet name | Reason for the data | Things to be aware of |

Petal Shape | I cheekily pinched the co-ordinates of this from Neil’s recent workbook (I do slightly transform the shape as I want the petals to be a bit thinner for my viz). These points form the shape of the petal. | See in the printscreen below how the shape of the petal goes up to point (0,1) and the bottom of the petal is at co-ordinate (0,0). This is something to be wary of when we want things to be in proportion later. We can scale these later on. |

Petals | The petals sheet will be what is used to form the number of petals. | We will want to make sure we use the correct join. The size column we will use to scale the petal sizes. The Dimension & Rank refers to the number of petals that will be created and the rank of each petal clockwise. |

Circles | The circles sheet will be what is used to form the circles around the bottom | We will want to make sure we use the correct join. The sizing values do not matter as they are independent of petal shape only relative to one another. Again, the dimension and rank refers to the number of circles and the order of them. |

**What should I do if I want to make amendments to the sheets?**

**Petal Shape:** If you want to make adjustments to the petal shape you can. I would recommend loading the petal shape sheet into tableau and creating calculations to adjust the size of the petal and re-export these values out. The current petal shape is as above, using 40 points through an ID.

**Petals:** The Dimension will be each petal (A-J in the mock data), currently 10 petals. Feel free to delete or add as appropriate. Assign each petal a rank value. If you’d like to amend the size of the petals then feel free. **I have made mine so that the maximum size the petal can be is 1**. Therefore all the other petals shrink based on the size given. This is important as i built everything between -1 & 1. Keep this in mind.

**Circles:** The Dimension column holds 6 circles; each assigned its own rank. Hopefully the structure of the data makes sense to be able to easily populate these with fields you want. For now, I would highly recommend against deleting any columns, as we may need them in calculations.

**General note: **Feel free to add as many extra columns in as you’d like.

**DATA PREP**

Connect to the Petals sheet.

– Create a **left join** between **Petals** to **Petal Shape** using a join of **1 = 1**.

Explanation: The petals sheet contains our petals. If we left join our petal shape to it we create the 41 points in the sheet for each petal. Creating the X, Y co-ordinates for each flower, causing the number of records to massively increase.

– Create a **full outer** join between **Petals** and **Circles** using **1=2**

So what’s with the circles join?

We want to include the circles in the one map layer. Creating the join of 1=2 means nothing is equal. In effect it is like stacking two separate datasets on top of each other but nothing in this case matches. The print-screen below shows how it will create nulls for the missing data. I do this so that I can easily tap into the different (X,Y) co-ordinates for the petal and the circles separately in a single sheet.

(I learnt about this from reading **Marc Reid’s** Blog on Geospatial Analysis **here**)

**THE BUILD**

We will create certain parts of the visualisation then go back to update calculations this will make it easier to fully understand.

**PETAL PREP**

**1a. Count of Petals**

10

Explanation: A count of the petals, I have hardcoded it. Please update where necessary.

**2a. Angle Petals**

(360/[1a. Count of Petals])

Explanation: We are creating equal gaps between the petals for the circle. The angle should be the same for all distances. We will come back and update this calculation.

**3a. Rank Angle Petals**

([Rank]* [2a. Angle Petals])

Explanation: To create what the angle is going to be we have to multiply the angle distance by the rank of each flower.

**4a. X Petal Rotated**

-([X Petal]* cos(RADIANS([3a. Rank Angle Petals])))

+ ([Y Petal] * sin(RADIANS([3a. Rank Angle Petals])))

Explanation: Since then I have found a good explanation online of how it works on Maths stack exchange. If you’d like to use their equations instead then feel free.

**4b. Y Petal Rotated**

([X Petal] * sin(RADIANS([3a. Rank Angle Petals])))

+ ([Y Petal] * cos(RADIANS([3a. Rank Angle Petals])))

Explanation: Within these calculations we are rotating the petal around a point using trigonometry. Below is the online example i found which is fantastic. I ended up using Neil’s equation from his workbook because I wanted to add in a few sizing controls later on, but I did test using the equation written in the same format as below which obviously also works for the petals.

We will revisit these calculations and amend them again later to make it half a circle and resize them accordingly. For now if you plot **X Petal Rotated** against **Y Petal rotated** you will see the flower shape!

For the time being lets move on to start to create the circles.

**CIRCLE PREP**

**5a. Rank For Circles**

[Rank (Circles)]/{COUNTD([Rank (Circles)])} * PI() * 2

Explanation: 2PiR, same concept as the petals but for the circle ranks. We will want to separate these out from the Players to be on its own axis. Do note that we are using the **rank from the circles** sheet!

**6a. End X Circle**

COS([5a. Rank For Circles])

**6b. End Y Circle**

SIN([5a. Rank For Circles])

Explanation: Using the Cos and Sin functions we can now make these into the circular points we need.

So we are half way there. Now we just need to make all the circles bunch at the bottom, and all the petals to be in the top half. Then we will want to see how we can put them onto one sheet. Lets start with the circles, as it’s easier.

Create the following Parameter.

**Condense Circle**

Explanation: We will add this into our circle calculations to make the gaps smaller.

Next make **Parameter Rotate Circle**

Explanation: We will want to move the circles to be around the bottom of the circle.

In truth these end values will end up being whatever is preferable, but once made it makes it the visualisation easier to adjust.

Update **6a. End X Circle **with

COS([5a. Rank For Circles]/[Condense Circle] + RADIANS([Rotate Circle]))

Update **6b. End Y Circle** with

SIN([5a. Rank For Circles]/[Condense Circle] + RADIANS([Rotate Circle]))

Have a play around with the new Parameters. Check that you can get the rotation and spacing changed. I recommend doing this in a fresh sheet where the axis are fixed between -1 and 1 on the X and Y.

Side note: It’s worth noting at this point when we made the circles it has a radius of 1. This is to my advantage because I know that I want the flowers to sit in the top half and have a radius of 1 too. If the petals and the circles had different radius’ I would have to scale them to bring them in line. You can see i set the parameter Condense to 2 and rotate to 166.

Now let’s go back and amend the petals.

**4a. X Petal Rotated**

-([X Petal]/1.5 * cos(RADIANS([3a. Rank Angle Petals])))

+ ([Y Petal] * sin(RADIANS([3a. Rank Angle Petals])))

*[Size]

**4b. Y Petal Rotated**

([X Petal]/1.5 * sin(RADIANS([3a. Rank Angle Petals])))

+ ([Y Petal] * cos(RADIANS([3a. Rank Angle Petals])))

*[Size]

Explanation: The first thing I do is add in a division into the X Petal part, I just want the flowers to be slightly thinner. Simply for aesthetics. The next thing is I multiply the petal by the size. Multiplying what was a length of 1 by a decimal will reduce the size of the flower proportionally.

Next I need to find a way to amend the gap between the flowers to make them all sit at the top.

Lets create a new parameter: **Rotate Flower**

Then let’s update

**2a. Angle Petals**

(360/[1a. Count of Petals]/2)-[Rotate Flower]

Explanation: Dividing the values by 2 makes them into a semi-circle. We have then added a rotate parameter just to make sure we can make the petals look even going outwards, in my final viz this value was 1.2 but have a play around with the slider to see what works. In the below screenshot it is 1.8

So now we have both parts of the visualisation. We have the circles prepped ready for the bottom. And we have the petals prepped ready for the top. Now we need to glue it together in one sheet. To do this we will need to use the new functionality of map layers.

**MAP LAYER BUILD**

**7a. MP Petals**

IF [Flower] = ‘A’

then

MAKEPOINT([4a. X Petal Rotated],[4b. Y Petal Rotated])

ELSE

MAKEPOINT([4a. X Petal Rotated],[4b. Y Petal Rotated]+3)

END

Explanation: We have two different Flowers A and B. We will want to create separate places for them to be plotted. The Makepoint is used to plot the points of the petals. All I do is shift the Y axis for flower B three to the right (Note: This was a good enough spacing as I remembered my petal leaves are radius 1)

Drag **Dimension**, **Flower** and ID from **Petals** onto **detail**.

Change the Marks to a polygon and drag **ID** onto **Path**.

Next we will want to add the circles in

**7b. MP Circles**

IF [Flower (Circles)] = ‘A’

then

MAKEPOINT([6b. End Y Circle],[6a. End X Circle])

ELSE MAKEPOINT([6b. End Y Circle],[6a. End X Circle]+3)

END

Drag 7b. MP Circles onto the marks layer.

Change the marks card to a **circle**.

Drag **Dimension**, **Flower** and **Shape** from the **circles** **table** onto the marks card.

(Side note: If we go to Map – Background Maps – None and then fix the Y axis between -2 and 2. And also fix the X axis between -1.5 and 4.5 we can see what it would look like so far)

We are very close now! It is mainly cosmetic calculations from here onwards.

(If you checked what turned the background map off, turn it back to light so we can add a few more things!)

I then add a circle into the middle of the circles.

**7c. MP Centre**

IF [Flower] = ‘A’

then

MAKEPOINT(0,0)

ELSE

MAKEPOINT(0,3)

END

Explanation: I am putting a centre circle in the petals for each flower. Flower A at (0,0), For Flower B at (0,3).

Drag **7c. MP Centre** onto **Map Layers**

Turn the marks to a **circle** and drag **Flower from petals** onto the detail card. Resize and colour at your leisure.

Next we could add some text too.

**7d. Name Tag**

IF [Flower] = ‘A’

then

MAKEPOINT(-0.38,0)

ELSE

MAKEPOINT(-0.38,3)

END

Explanation: For flower A position the point just below 0,0 for Flower B do the same remembering its co-ordinates are three to the right.

Drag **7d. Name Tag** onto the marks card and change to **text**.

Drag **Flower from Petals** onto detail.

Drag **Flower** and **Name** onto **Text**. To turn off the ugly grey text background click **colour and halo ‘none’**.

Think I will leave it there for this run-through of the map layers. If you get stuck do dig through my original workbook online. There are a few additional touches that I added such as mapping my own background image onto the picture, a few colouring tips. **One last thing to note is not getting the circles data mixed up with the petal data when you drag things onto the detail card.**

If you would like the background image I’ve attached it below. To add this go to **Maps – Background Images – add Image.** I’ve attached the sizing’s. You will want to make your axis fixed to the same sizes for this image to work.

To create this image in the first place what I did was create the chart, then export the chart from the sheet as an image with my axis already fixed. I went into Photoshop and created the background using the image as a reference then saved it without the original chart. This is how best to get the proportions of the circles right if you want to create your own.

The alternative to this would be create your frames as shapes and add them in as layers. **Simon Rowe** shows how this can be done in his recent **Lacrosse** visualisation. Simon’s **blog post** covers off his alternative method of adding a background.

Thanks for giving this a read. Not sure this is really one that will get recreated, but hopefully there are some technical takeaways from it (creating your own petal diagram, trigonometry behind flowers and circles, map layers). I’d love to see someone utilise this in their own way.

As always, if you have any questions please reach out to me on **Twitter**, or **Linkedin**.

Logging OFF.

CJ

## Leave a Reply