Exercise: Make a Scatter Plot in Tableau

Sales and AVG Quantity by Segment and Product Name

Scatter plots are an excellent choice for illustrating correlations and creating segments. In this self-guided exercise, you will create a scatter plot in Tableau to compare the Sales and Quantity measures by two different dimensions.

Hi. This is Ryan with Playfair Data TV and in this exercise you’re going to recreate this scatter plot. The format for this exercise is you’re going to take a shot at recreating this scatter plot, I’ll give you a couple of clues. Then you should pause the video, take a shot at doing it on your own, once you’re ready, hit play, I’ll come back to show you how I would approach the same business question.

Couple things about this scatter plot. On the y-axis, you’ve got a measure of sales and on the x-axis, you’ve got a measure of average quantity. I want you to note the aggregation. Anytime you see the aggregation as part of the axis title, that means that it’s being aggregated as something other than the default aggregation. So you want to make sure you apply a different aggregation.

We also see that the circles are being colored by the segment dimension. I know that because of the color legend in the top right corner of this view. The only clue that you couldn’t get from the picture itself is actually in the title of the exercise. We’re not only breaking this down by the segment dimension, but we’re also breaking it down by the product name dimension. So take a shot at that. When you’re ready, hit play and I’ll show you how this was done.

All right, so how I would approach building this scatter plot. I know that the default behavior in Tableau, when you double click on the first measure, is for it to put it on the rows shelf, which is exactly where I want to put the sales metric. Because that’s my what’s called dependent metric for the scatter plot, so my primary metric. So I just go ahead and double click Sales and it will be added as the y-axis or it will be added as the rows shelf.

The other metric is quantity. And remember, we saw something other than the default aggregation. So there’s two ways we can make this average quantity instead of sum of quantity. We could just double click on Quantity because the default behavior is for Tableau to put that second metric onto the columns shelf. So that gets us the foundation for our scatter plot. But if we did it this way, we would have to remember one extra step, which would be to change the aggregation of this measure from sum to average. You can do that by either right clicking on the pill or clicking the down arrow that appears when you hover over the pill. Then hover over measure sum, which is the current aggregation, and change it to average.

There is a slightly easier way, this is a shortcut that I like to use. I’ll just undo twice, get us back to just the bar chart with sales. Instead of double clicking on my second metric, which by the way in the context of the scatter is referred to as the exploratory metric, this time I will right click on the metric and while I’m holding down the right mouse key, I’m going to drag that to the columns shelf. And once I drop it there, instead of it drawing something right away with the default aggregation, it gives me the choice. So I can just choose average immediately instead of having to go through those extra couple of clicks to choose my aggregation.

That gets me a scatter plot with one circle. We haven’t specified anything more granular than the entire file. So we just see that one circle, which represents the combination of sales and average quantity for all 9,994 rows in the sample superstore dataset. I’ll also change my mark type from this open circle shape to this closed circle shape, so we can see these a little bit better. And I’ll change the size of that circle by clicking on the size marks card and dragging the slider over the right a little bit.

So we want to make this more granular. You saw on the screen shot that we were also coloring the marks by the dimension of segment. There’s only one way to color marks on the view, it’s to put something onto the color marks card. So I drag the segment dimension to the color marks card, which will get me three circles instead of one because we’ve now changed the level of detail from the entire file to the segment dimension. And the last thing, the only clue that wasn’t pictured on the screen shot itself, is we’re going to take that level of detail even further. Instead of looking at this view as just sales and average quantity by segment, we’re going to look at these metrics by segment, as well as product name.

One of the ways you can change the viz’ level of detail is to put something on the detail marks card. So we’ll drag the product name dimension to the detail marks card to help us finalize this view. And that’s essentially the scatter plot. I’ll give you one last formatting trick here in this video.

I often make the opacity of my marks about 85% or 90%. This has a couple of benefits. One is true of any chart type, it reduces the saturation of the color, which makes it a little bit easier on the eye. But it has a secondary benefit with a scatter plot, which is because it’s more transparent, you can see some of the overlap between the marks, which you’ll often see with a scatter plot. To reduce the opacity of a mark simply click on the color marks card and drag this slider over to the left. And I usually go to about 80% to 90%.

With a scatter plot if I’m wanting to show more of the overlap, I might lean more towards the transparent side or the less opaque side. So maybe you could do 75%. You could just type that in here and you can see that the marks are now a little bit transparent, so we can see some of the overlap.

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

Tableau Chart Types Videos

Join Playfair+ Today

All members receive exclusive access to over 160+ videos and counting across eight learning paths.