Creating Lollipop-Jitter Plots in Tableau

Jul 14, 2020

Klaus Schulte

A few days ago, I came across this tweet by We are R-Ladies, who linked an original post by Cédric Scherer from last year. Cédric developed R code to create something that I would call a Lollipop-Jitter plot. This cool chart has it all, the overall picture and the granular details. Really great work!

Also great: the gif he created to demonstrate his thought and developing process starting from a “boring” boxplot.

Is a Lollipop-Jitter plot also doable in Tableau? Of course it is 🙂

Let’s see how to create this chart in Tableau.

1 Data

I’ve used Tableau’s Superstore data and wanted to take a look at 2019’s profit ratios on sub-category and manufacturer level.

To create the chart in Tableau according to Cédric’s example it needs one extra copy of the data. Therefore I dragged on ‘Orders’ one more time and created a field ‘Copy’ which I will reference in my formulas.

Data Densification


CASE [Table Name]
WHEN "Orders" THEN 1
WHEN "Orders$" THEN 2

Another way to do the data densification is the internal data densification method.

Also, I filtered the data down to the 2019 values using a datasource filter.

2 Calculated Fields

[Profit Ratio] (comes with Superstore)


[PR subcat] (profit ratio by Sub-Category)

{ FIXED [Sub-Category]:[Profit Ratio]}

[PR total] (yearly profit ratio)

{ FIXED YEAR([Order Date]) :[Profit Ratio]}

[Jitter Axis]

CASE MIN([Copy])
WHEN 1 THEN AVG(random())

For my first copy of the data I display profit ratios by manufacturer on the x-axis. AVG(random()) will create the jitter effect to prevent the overlapping of data points by randomly placing them on a y-axis between values of 0 and 1. The second copy of the data will be used to display sub-category profit ratio. I wanted this dot to be center aligned on my jitter axis and therefore defined a fixed value of 0.5.


CASE MIN([Copy])
WHEN 1 THEN [Profit Ratio]
WHEN 2 THEN AVG([PR subcat])

For the dot plot, level of detail in my view will be Manufacturer, therefore I can use [Profit Ratio] for my first copy of the data. For the second copy, I will use the [PR subcat]-LOD.

[Bar 1]

IF MIN([Copy])=2 THEN AVG([PR subcat]) END

[Bar 2]

IF MIN([Copy])=2 THEN AVG([PR total]) END

My bar chart will actually be a line chart, connecting each sub-category profit ratio with the total profit ratio. Again, I’m using the (center aligned) second copy of the data.

That’s basically all. There are a few more calculated fields in the workbook for the tooltips, which are not required for the chart itself.

3 Creating the Lollipop-Jitter Plot

With these calculations we are now able to draw our Lollipop-Jitter plot:

Dot Plot:

  • Drag Sub-Category on Rows
  • Drag Jitter-Axis on Rows
  • Drag Bubbles on Columns
  • Drag Sub-Category on Color, Manufacturer on Detail and Copy on Size.
  • Set opacity to 60%

Edit size accordingly and fix jitter axis from -0.2 to 1.2.

Marks card dot plot
dot plot

“Bar” Chart

Like already said, the bar chart is actually a line chart. To create it,

  • Drag Bar 1 on Columns,
  • Drag Bar 2 on the Bar 1 axis until you see two parallel green bars, and let the field drop – this will create a combined axis and Measure Values will appear in the green pill on the column shelf.
  • Drag off Manufacturer from Detail
  • Drag off Copy from Size and on Detail
  • Change the mark type to Line
  • Create a dual axis and synchronize the axes
  • Set opacity to 100%.

Edit size of the line chart accordingly.

marks card line chart
combined view

4 Add Reference & Zero Line

To add the vertical reference line for the total profit ratio, put [PR total] on Detail, add a reference line, and select [PR total] to be displayed:

reference line


Last thing you probably want to do is adding some explanatory tooltips. Therefore, you have to create a few calculated fields to define the tooltip depending of the actual copy of the data.

I hope you all enjoyed reading about and that you will find own use cases for this. Again, all credits to Céderic Scherer for sharing this chart on his blog.

If you have any questions or feedback, please leave a comment below or reach out to me on Twitter @ProfDrKSchulte.