Getting Animated Part 3 – Scatter Plots In Tableau
This is the third blog in a short series on Tableau’s animation feature, available in releases 2020.1 and higher. This series looks at the fundamentals of animation and how they affect the core chart types that we tend to use in Tableau. Part 1 looked at line charts, and part 2 focused on bar charts. Now, let’s move on to scatter plots.
I think that, for a lot of users, comprehending how animations work helps understand so much about the inner workings of Tableau, and reveals what you’re actually seeing on the page. More on that later. First, let’s get stuck in.
The difference that animation makes with scatter plots in Tableau
Before animation came in, our dots or shapes that appeared in a scatter plot didn’t transit across the screen. If the filters changed, all we could do was compare the state before and after. That’s what’s happened in this example below, where the second chart is exactly the same as the first chart, except that there is an additional year of data.
So we have 17 circles, each representing a subcategory of product, that are colour-coded by their parent category, and positioned according to both the value of sales that were in the South East and the proportion that were shipped First Class.
In this case, I haven’t labelled them. It’s often tricky with a lot of marks that have similar properties such as this to label everything. But then, how can we be sure which of the red marks in the first chart then surges beyond 25% first class shipping with the addition of 2019’s data? Without labelling or further interaction with the viz, perhaps through a tooltip, we can’t be certain. And this remains true in Tableau 2020.1 and higher, unless animation is enabled. So, let’s enable the animation, and see what difference it makes.
So, now by toggling the end date of the range we can see exactly which of our subcategories experienced a boost in First Class sales in 2019 (Copiers), and with a nifty viz in tooltip also validate the extent of that change. Without animation, we could still have identified that Copiers had the highest First Class rate, but would then have needed to go back and hovered over each the red marks in turn to establish which one of them was Copiers. And only then would we be able to start thinking about the before and after states, and work out by how much each of the two measures are changing.
Before getting back into the different types of filters, I want to use a few paragraphs to explore the phrase “mark transitions”. When the animations feature was launched this term was used interchangeably by some (in other places you might see “animated transitions”), and it can shed a little light on what is going on underneath the bonnet (or the “hood”, if you’re so inclined). And, since I was pretty ignorant towards this for many months into my Tableau journey, the following explanation is pitched towards the novice Tableau user who might benefit from this explainer.
Here are the two main places you’re likely to find a reference to “marks” in Tableau. The marks card (left), and the status bar you’d usually find at the bottom of your Desktop or web-edit window (right):
In the case of our scatter plot, we have 17 subcategories, each of which are represented by a “mark”. You can see that from the marks card, because Subcategory is assigned to ‘Detail’. The 17 marks each have one of three colours, associated with the Category, which is on the marks card assigned to “Colour”. What’s important to convey here is that there is hierarchical relationship between Category and Subcategory – if a different field, Segment say, was assigned to “Colour”, or even added to the “Detail” then we would get additional marks in our scatter plot, one for every permutation of Subcategory and Segment in our dataset. And, although in this case there is another pill added to “Detail”, this doesn’t disaggregate the data further. It’s a measure, and one that is there to supply the reference line.
So, a mark is a point on our canvas representing an item of data. And so a mark transition is the movement of that mark as the data it shows changes, relative to the axis or axes. And that then helps us to better understand the difference between the types of filters, and what they’re doing to our marks…
Slicing vs Non-Slicing Filters
I covered this in relation to both line charts and bar charts in the first two parts of this series, but I feel that the concept is so much clearer when we’re looking at scatter plots. A slicing filter is one that changes a dimension that is not in the view, but has the effect of taking a ‘slice’ out of the records which aggregate to make a mark. So, our ‘Copiers’ mark is actually the representation of 68 records from our dataset, aggregated to a single data point. When the data range only ran up to 2018, however, there were just 46 records represented. So, the ‘Order Date’ filter is a slicing filter – it takes a slice out of our data when we restrict the range shown. And if a deselection using a slicing filter then accounts for all of the records from our dataset that were in the mark, that mark would then disappear.
The example below shows two slicing filters on our data. The first, Segment, simply takes a slice out of each mark. That’s because every mark in this example includes records from every segment. However, if we take the date range back far enough, to just Jan-Apr 2016, then we see that three of the 17 marks disappear, and we’re left with only 14. That’s because for three of the Subcategories, there were no records within that date range, so we’ve sliced them so far as to eliminate them from our view entirely.
Now if we turn to non-slicing filters, the impact is a lot more evident. Non-slicing filters affect dimensions which are in the view, and by deselecting items from the filter we will directly remove them from the view, either individually or in groups. So, deselecting a SubCategory will remove it from the view. Reselecting it will add it back into the view.
Deselecting an item that pertains to multiple marks, such as the Category, will remove all of those marks from the view.
Concluding ‘Basic’ Animation
That concludes the three parts looking at the basics of animation in relation to the three primary chart types. There remain plenty of more complex ways of animating, using less common chart types, which other blogs have covered well. Subsequent parts in this series may, however, look at animation alongside interaction.