Drawing Shapes in Tableau
Final yr I introduced a Assume Information Thursday with Noah Salvaterra and Chris DeMartini referred to as « I didn’t know that was Tablossible ». In that presentation, I did a brief demonstration of methods to construct a coronary heart in Tableau. Since Valentine’s day is tomorrow, I assumed I might submit directions on how I constructed the guts, and different shapes, in Tableau.
Replace – Ken Flerlage was engaged on a really related submit across the identical time as this submit. Make sure you take a look at his approach in building a Valentine’s Day viz for his wife posted here. I particularly like how he used the dimensions of the dots for large occasions, for instance their first date and the beginning of his kids. Nice work Ken!
In lots of my earlier posts you’ll discover that I exploit a variable T for the curves that I construct in Tableau, typically from -6 to six. For instance, that is the start line for building sankey diagrams in Tableau. In that instance, the values have been in increments of .25, which I used to plot the factors alongside the road. On this instance I’m going to do the very same factor, however in increments of 0.01, which is able to create 1,201 factors (additionally from -6 to six).
Step 1 – Create 2 Rows of Information and Import into Tableau:
There will probably be one column referred to as Vary (which is the equal of T) and it’ll have two worth, 1 and 1,201. That is all the dataset. You may copy and paste the three traces into Tableau as a dataset.
Step 2: Create a BIN and three Calculated Fields
Vary (bin) – Proper Click on on Vary and choose Create and Bins. Set the dimensions of the bins to 1 after which choose OK.
Calculated Subject Title: Index
Calculated Subject Title: Coronary heart X
Method: 4 * SIN([Index])^3
Calculated Subject Title: Coronary heart Y
Method: (3 * COS([Index]) )- 1.3 * COS(2 * [Index]) – (0.6 * COS(3 * [Index]))-(0.2 * COS(4 * [Index]))
Step 3: Construct Coronary heart
Transfer Vary (bin) to Columns. Proper-click and choose « Present Lacking Values » (this activates knowledge densification for range-aware drugs).
Transfer Vary (bin) from Columns to Particulars (you may’t « Present Lacking Values » on Particulars)
Transfer Coronary heart X to Columns
Transfer Coronary heart Y to Rows
Set Coronary heart X, Coronary heart Y to Compute Utilizing Vary (bin) by right-clicking every capsule, after which choose « Compute Utilizing » and choose Vary (bin).
It’s best to now have a coronary heart with 1,201 marks.
Step 4: format the Coronary heart
Choose Traces from the Marks dropdown.
Choose shade and select the colour you need your coronary heart to be. I used HTML: #e15759 for the guts proven beneath.
Alter the Dimension as desired
To create these subsequent shapes, I imported into Tableau values for T, starting from -6 to six in increments of 0.01, so this time the info set is 1,201 rows. Then I created new formulation for X and Y to create these shapes in Tableau.
Calculated Subject Title: Butterfly X
Method: sin([T]) * (EXP(cos([T]))-2 * cos(4 * [T])-sin([T]/12)^5)
Calculated Subject Title: Butterfly Y
Method: cos([T]) * (EXP(cos([T]))-2 * cos(4 * [T])-sin([T]/12)^5)
Calculated Subject Title: Flower X
Method: sin([T]) * (EXP(cos([T]))-2 * cos(8 * [T])-sin([T]/12)^5)
Calculated Subject Title: Flower Y
Method: cos([T]) * (EXP(cos([T]))-2 * cos(8 * [T])-sin([T]/12)^5)
Have a Blissful Valentine’s Day
I hope you discover this info useful. In case you have any questions be happy to e-mail me at Jeff@DataPlusScience.com
Jeffrey A. Shaffer
Comply with on Twitter @HighVizAbility