Online tableau training, tableau tips, & video tutorials

Chart Types

Memberships

How to Make Unit Histograms in Tableau

Preview

Instructor

Ryan Sleeper

Learn How to Stack Marks to Create Wilkinson Dot Plots

Ryan guides you through the evolution of a traditional histogram, to a traditional unit chart, to a Wilkinson dot plot (also known as unit histograms). You will also see multiple ways to add context to this engaging chart type.

Hi, this is Ryan with Playfair Data TV. And in this video, I’m going to show you how to make unit histograms, or they’re also known as Wilkinson dot plots in Tableau. Unit histograms are similar to traditional histograms, but instead of bucketing things into bins like traditional histograms, it looks at the distribution of individual units instead. So it’s also very similar to a unit chart, which I’ve also shared here at Playfair Data TV, but it’s a little bit different from that as well because you can use a mark type other than Bar. So it’s a little bit more flexible, a great way to look at distribution. It’s very engaging and very effective.

To get started, we’re going to use a measure that has individual units in it. The best example I can think of from the Sample – Superstore dataset is the Order ID field. So I’m going to right-click on the Order ID dimension while I drag it to the Rows Shelf, which will allow me to choose an aggregation of COUNTD.

So this is a count of unique orders in the Sample – Superstore dataset. And I will look at that by continuous day. Again, I’m going to right-click on my Order Date field this time while I drag it to the Columns Shelf, which will allow me to choose whether that date is being used as discrete or continuous, and what the date part is.

For now, I’m just going to choose Order Date Continuous and click OK. And we’ve got a continuous line graph here with a lot of marks on the view. You can’t quite see this come together yet, but trust me– so far, what it’s doing is looking at the number of unique orders per day across all four years in the sample dataset.

The next thing I’m going to do is change the mark type from Line to Bar. And it looks pretty similar, but now we just have bars at each day in the dataset as opposed to a continuous line. So that we can see these bars a little bit better, I’m going to filter on the Order Date field to– we’ll just say the last week or so in the sample dataset. How about from Christmas day– it’s always easy for me to remember– 2018 through December 30th, 2018. And I’ll click OK.

And at this point, we technically have a histogram because we are comparing things on two continuous axes. Both of these pills are green telling me both the y-axis and the x-axis is a continuous field.

But from here we’re going to convert this to a unit chart by putting the Order ID field onto the Detail Marks Card– so, Order ID to Detail. And you can start to see this coming together a little bit. Let me actually make these marks bigger so we can see them. That’s a little bit more helpful.

And just so we can take a little bit more advantage of that x-axis– this is kind of a weird thing, a weird way that Tableau formats dates– but if instead of using a continuous Order Date, I were to go in here and choose Continuous Day, which is essentially the same thing, but we’ll get a slightly different look, take more advantage of that horizontal real estate on the x-axis.

But essentially at this point, we have a unit chart, which I have shown you how to do in another video. But now we’re going to take this a step further and convert it to a unit histogram, and we’re going to do that by changing the mark type from Bar to Circle. And that’s one of the advantages to unit histogram versus unit charts is you can use any mark type you would like. If I choose Circle instead of Bar, you’re going to notice something, a big change here. What happened is all of those individual stacks, they kind of fell to that mark on the axis for 1. However, there are multiple units or multiple orders, in our case, that are just right on top of each other on that 1 level on the y-axis.

Here’s a little known trick in Tableau– if you go to Analysis in the top navigation and hover over Stack Marks, the default is for those circles, in this case, to not be stacked on top of each other. But if we flip this back to On, you can start to see this come together. And this already technically is a unit histogram.

In my opinion, it has an advantage of allowing you to show some extra context to those individual units. So just like I showed you on the video on how to make unit charts in Tableau, I’ll show you how you can add even more context to these individual units by dragging the Profit measure to the Color Marks Card. Now instead of just seeing the distribution, or the number of orders per day Christmas week, we can add some extra analysis. We can make this analysis more in-depth by adding measures to the Color Marks Card.

Whenever I’m coloring on a diverging color palette like this, I typically like to edit this color legend and just change the step size down to 2. This will just give me one color for positives and one color for negatives. And I’ll also put this in-brand by choosing colors that are a little bit closer to what we use here at Playfair Data. And I’ll go ahead and click OK.

So at this point, we’ve already made this a little bit better. We’re seeing not only the number of orders per day, we’re seeing per day how many of those orders were profitable versus not profitable. We could make this even better by sorting those units. We could say put all of the positive orders on the bottom, all the negative orders on top so that they’re even easier to compare across this one week in the dataset.

You can do that by clicking on the Dimension that you want to sort by– it’s currently on the Detail Marks Card– and click Sort. And one of the options is to choose a field, and I will sort these by their Profit values. You already saw it update there in real time behind the view. That’s exactly what I wanted. I’ll go ahead and close this, maybe make these circles a little bit bigger so we can see them.

Another nice piece of context that we could add to this– because we are looking at unique orders, why not give some information about those orders? Maybe where did they originate? When were they ordered? When were they shipped? You could get creative with this and provide any detail that you would like just by adding fields to the Tooltip Marks Card.

The default Tooltips are showing us the Order ID and the day of Order Date as well as their profit values. Let’s polish those up a little bit. I like Order ID in there, but maybe instead of using the day of Order Date, we– actually that’s not bad. But just to make sure it’s using the day we’ll add both the day it was ordered as well as the day it was shipped. And you can do that by right-clicking, dragging each date to the Tooltip, and choosing attribute of Order Date for the first one. I’ll do that also for the Ship Date, choose attribute of Ship Date.

Just to make sure those were added, I’ll hover over. It’s looking good so far. I like Order ID on there, but maybe I will also add City to Tooltip and State to Tooltip. Again, just hovering over to make sure everything I wanted is represented on the Tooltip.

Now that I know everything is there, I might go in here and modify this a little bit. I don’t want that first Order Date. Maybe I will put “City, State” underneath the Order ID. And let’s see– we don’t need Country, that’s too granular. I like showing when it was ordered, but I can maybe go in here and make that a little bit shorter. So Ordered, Shipped, and– sure, we’ll leave Profit in there.

You get the idea. Obviously, these are very flexible. We have a few videos here at Playfair Data TV to show you some pretty cool tricks with tooltips. Maybe I will just center all this, but we’ll call it good for now. Click OK.

And now, just to review how far we’ve come with this, this chart is now showing me a distribution, the number of orders per day from December 25th through December 30th. Those individual units are colored, based on whether they are positive or negative. We changed the sort order of those units to stack our positive orders on bottom, followed by negative orders on top, and we’ve just added some additional context by just adding fields to the Tooltip Marks Card.

This has been Ryan with Playfair Data TV – thanks for watching!