Tableau Tips: How to assign shapes correctly in Tableau?
After a hectic week, I happily opened my laptop on a late Friday night. I was eagerly waiting for the weekend to work on the viz idea I had. I downloaded the images for my viz and when I assigned them in Tableau, I notice that it is all messed up!
So what went wrong? I’ll cover a few scenarios and ways to assign shapes correctly
How to assign a shape?
Let’s start with the basics. To assign the image as a shape it must be in the Shape folder.
The folder can be found here
My Documents > My Tableau Repository > Shapes
Scenario 1:
So I found this amazing dataset on Kaggle which has all the emojis (and if you don’t know this already, I’m an Emoji person :D)
Dataset: https://www.kaggle.com/subinium/emojiimage-dataset
The good thing about the dataset is that it has a Serial Number “#” and the emoji images have the same number.
So I created a simple view with the shapes on #.
And this is how the images are numbered
So do you think the images will get assigned correctly? Let’s take a look.
So what went wrong? The order of images is the same as mentioned in # but when we see it in the shape window, it looks different.
The sorting is different. We expected it to be sorted in the numerical order shown on the left side of the image. But what we got is the alphabetical sort shown on the right side.
The order of the shapes below is left to right alphabetically
So how to assign the shapes now? Not manually, please :)
We’ll need to make the sort of the # Field the same as of image.
So let’s change the sort to alphabetical.
Now you’ll see how your numbers on the right side is the same as the images
And if you assign it now, it would be correctly assigned.
Scenario 2:
A little background on this scenario: I was building a viz with Movies and their images but the movies had mixed case characters in the file. So when I tried to assign the images, they were assigned incorrectly.
The images are named as below
But the values in Tableau are mixed case.
If you have images in mixed cases, that would change the sorting order.
The image on the left is how tableau sorts mixed cases alphabetically. When I changed the value to lower case, we see the sorting as shown in sort 2.
To understand this, let’s talk about ASCII for a moment.
ASCII is a character encoding that uses numeric codes to represent characters. These include upper and lowercase English letters, numbers, and punctuation symbols.
Refer to the Wikipedia page.
So in short, the uppercase letter comes before the lowercase.
So to assign this correctly, let’s create a field as lower([value]) or upper([value]). And assign the shape on this new field.
Scenario 3:
For this exercise, I created images of English Letters which we will be used in this example.
Dataset: Superstore
I created a worksheet with the first letter of the customer names.
Now, I’ll assign the shapes by the first letter
These look odd, right? So it looks like the superstore data doesn’t have a name starting with U and so the shapes have been wrongly assigned from the letter V.
This was a misconception that I had with shapes initially. Even though the image name and field values are the same, they didn’t assign correctly.
To assign it correctly either manually assign for those letters. Or remove U from the shapes folder and assign the shapes again.
That’s a wrap. Good as hell, right? 😂 Damn it, can’t stop thinking about the song.
I got distracted there for a second but I’m back now. So I hope you got some tricks to assign shapes.
Have you faced a scenario where assigning the images was a challenge? Let me know in the comments sections.
Thanks for the read :)