A few weeks ago I had to do Workout Wednesday Week 6 from 2019 as a Friday project. When I checked it out, I was excited, it looks quite pretty but I had never heard of a “tree plot” before. I had to figure it out in time for the evening presentation.
In this blog I will only cover the tree plot, although in the Workout Wednesday there is also a table on the tooltips.
Step 1: Download the data set
The data used for this viz is Superstore. In case you do not have it already, you can download it here.
Step 2: Building the trunks
To build the trunks we are going to drag Segment into Rows first. Then right click on Order Date and drag it to columns. Select Weeks continuous. Additionally, we can see that the original viz only has values from 2018, so we will put Order Date on filter too and filter for the year 2018.
You should have something like this:
The trunks themselves are the weekly number of orders, so drag Order ID to Rows and set it to Count Distinct (COUNTD) and make sure you have it as a bar. Then bring Segment on to colour and you should have the trunks ready! Adjust the size of the bars if necessary. I will change the colour latter when formatting.
Step 3: Building the leaves
This was the trickier part. The circles on the trees are meant to represent each order sorted descending by sum of sales. So I started by duplicating the Order ID field. Press Ctrl and click and drag the Order ID field on the rows, placing it to the right of the original. Make the duplicated field a circle.
After a bit of playing around with it, I realised I had to do a Running total of the orders, so a table calculations. First place Order ID on the details card. Then the table calculation would need to be set up as:
Don’t forget to also set up the sorting order as descending by sum of sales.
Then we right click on the second Order ID and make it a dual axis, synchronizing the axis. Also add Sum of Sales to the Size marks of the circles.
Step 4: Formatting
Finally, we just need to format it the same way as in the Workout Wednesday. That would be adjusting the size and opacity of the circles. I set the opacity at 35% and with the sizes you will probably have to play around a little until you are happy with the proportions.
Remove the gridlines and set the axis to start at zero.
Then change the colours. I used the colour palette that I thought was closer to the one in the original viz: Hue Circle.
The result of this should look similar to:
To find the original viz, you can click here.
I hope this tutorial has been helpful and thank you for reading! If you have any questions or comments, you can find me on twitter @carmen_data.