The right way to Separate a Field Plot and Unit Histogram in Tableau
In a current weblog publish by Steve Wexler entitled Is this better than a Jitterplot? Could be, Steve explores alternate methods to visualise a jitterplot (a dot plot with random jitter to separate the dots). On this publish, I present how one can create a field plot separated from the unit histogram.
A Unit Histogram
Steve outlines the steps on how one can make this unit histogram in his publish and his Tableau visualization is here. I’ll use this as the place to begin for this weblog publish, so if you wish to comply with alongside, download his workbook here.
Right here is Steve’s Unit Histogram.
Eradicating the Distribution Bands and Including a Field Plot
Upon getting Steve’s Tableau workbook downloaded and open, right-click on the principle dashboard tab « Wage Comparability Jitterplot Dashboard (2) » and choose « Unhide All Sheets ».
Go to the worksheet Breakout with Quartiles. Click on on the road within the distribution band and drag it off the Tableau Canvas. Another choice is to right-click on the road and choose « Take away ». Repeat this step for the distribution band as properly. It’s best to now have a Unit Histogram with out the distribution bands.
Click on on the Analytics Tab within the prime left nook. Click on and drag Field Plot to the Tableau canvas and place it on SUM(Steady Bin). This may add a field plot to the unit histogram.
That was fairly simple, however discover that the field plot facilities within the pane and covers a few of the dots.
Let’s discover just a few choices to shift the field plot out of the best way.
Shifting the Place of the Field Plot
The First technique will shift the field plot by creating extra dots. We’ll do that by creating one other capsule and utilizing a twin axis.
Double click on on the Column Shelf within the white space to the correct of the INDEX() capsule. This may help you enter an in line system. Sort -20 and hit enter.
Proper-click on the brand new capsule and choose « Twin Axis ». Proper-click on the brand new secondary X-Axis on the prime of the chart and choose « Synchronize Axis ».
On the Marks card for SUM(-20), click on on Colour and set the Opacity to 0% and the Border to « None ».
It’s best to now have a Unit Histogram that begins within the heart of the Field Plot.
Nevertheless, you’ll discover that the dots are nonetheless hidden behind the field plot for most of the factors. You possibly can change the X-Axis to Fastened to regulate the place, however I believe you will discover that it is troublesome to place the field plot in a approach that does not overlap the dots and nonetheless exhibits all the dots.
Separating the Field Plot from the Unit Histogram
The obvious method to separate the field plot and the dot plot is to create a worksheet for every field plot and unit histogram. On this case, there are 4 generations, so that might be eight worksheets. This strategy permits you to create a special view for every era, one with a field plot and one with a unit histogram and it is fairly straight ahead to duplicate the sheets and alter the filters accordingly to create every view. This is not preferrred and as you have got extra classes this might rapidly get unwieldy.
One other technique to separate them is to duplicate the information. This may be accomplished with Customized SQL, Tableau Prep, Alteryx or preprocessed within the unique knowledge supply. To make issues simple for this demonstration, you may download the duplicated data here. This spreadsheet merely duplicates the unique knowledge together with a brand new column referred to as « Column ». The primary set of the information has a price of « field » on this new column and the second set of information has the worth of « dots ».
Choose « Knowledge » from the highest menu and choose « New Knowledge Supply ». Choose « Microsoft Excel » and choose the file that you just downloaded, BoxandUnitHisto.xlsx. This may open the brand new knowledge supply. Click on on the Breakout with quartiles tab once more to return to the Tableau canvas.
Choose « Knowledge » from the highest menu once more and choose « Substitute Knowledge Supply ». The « Present: » knowledge supply must be set to Reshaped Survey Knowledge and the « Substitute: » knowledge supply must be set to Sheet1 (BoxandUnitHisto). This may exchange the only knowledge supply with the brand new knowledge supply that duplicates all the information and has a brand new subject referred to as « Column ».
One of many massive points with duplicating a knowledge set is that calculation could be affected. For instance, Steady Bin, which is the principle subject on the Y-Axis has now doubled. There are a selection of the way to cope with this, however we’ll apply a easy repair to this, which is to divide the quantity by 2. Observe – this will not be one of the best answer in each case.
right-click on Steady Bin and add /2 to the system in order that the worth will divide by 2.
Drag the Column capsule to the Column shelf after Breakdown. Drag SUM(-20) up and off of the canvas to take away the capsule or right-click and choose « Take away ».
Proper-click on Steady Bin and choose « Duplicate »
Proper-click on the brand new subject Steady Capsule (copy) and choose « Edit »
Alter the System: IF [Column] = ‘field’ then INT( [Value] / [Bin Size]) * [Bin Size]/2 ELSE null END
Drag the brand new Steady Capsule (copy) to the Rows shelf subsequent to Steady Bin
Proper-click on Steady Capsule (copy) and choose « Twin Axis »
Proper-click on new secondary Y-Axis on the right-hand aspect and choose « Synchronize Axis »
Drag the field plot from the Dots pane off of the Tableau Canvas to take away it, or right-click on the field plot within the Dots pane and choose « Take away »
You’ll now have a field plot that’s solely within the left pane window marked « field » and never within the second pane marked « dots ». Making the dots disappear in « field » pane is a bit difficult. I believe you will discover that the Opacity, Colour, Borders and Dimension do not work for this. So we’ll create two extra fields to cope with this.
Calculated subject: Col Num
System: IF [Column] = ‘field’ THEN 0 ELSE 1 END
Calculated subject: Rely
System: IF avg([Col Num]) = 0 THEN null ELSE index() END
Substitute INDEX() on the Column shelf with the brand new subject Rely
Proper-click Rely on the Columns shelf and choose « Compute Utilizing » and set it to Resp ID
It’s best to now have a field plot within the first column pane and a unit histogram within the second column pane. The remaining is just formatting as desired.
Proper-click within the chart space and choose « Format »
Choose « Borders » and slide the « Column Divider Stage: » one place to the left.
Proper-click on the secondary Y-Axis Steady Bin (copy) and uncheck « Present Header » to take away
Proper-click on the column header with « field » and « dots » and uncheck « Present Header » to take away
Alter the colour of the dots as wanted.
There are actually draw backs to duplicating the information, nevertheless, the tip end result here’s a field plot that doesn’t overlap the unit histogram and that has some main benefits over the standard field plot that’s plotted over prime of the dots. This strategy will also be used with distribution bands. Merely exchange the field plot pane with a distribution band.
This may be used with a jitterplot as properly, however I discover the unit histogram to be rather more informative than the random placement of the dots utilizing jitter.
I hope you discover this data helpful. When you have any questions be at liberty to electronic mail me at Jeff@DataPlusScience.com
Jeffrey A. Shaffer
Observe on Twitter @HighVizAbility