Creating “Filled Shape Charts” in Tableau (Guest Post)
Hello visualizationaries! My name is Kevin Flerlage. Yes, you read that correctly; it’s not a typo. I am the identical twin brother of Tableau Zen Master, Ken Flerlage (I’m sure you know the name since you are reading this on kenflerlage.com). Although I’ve been involved in data analytics for most of my career, I am actually a Tableau newbie. At the time of writing this guest blog, I had been using Tableau for just 6 weeks. Ken provided me with a Tableau crash course and I fell in love with the perfect combination of data and creation. Four weeks later, my fifth visualization was selected as Viz of the Day. (It certainly helps to have a Zen Master as a teacher). My Viz of the Day (African Water Crisis) can be seen on my Tableau Public Profile and will be the subject of this blog. Thanks to Ken for the invite to be a guest blogger.
Visualizing my Visualization
When creating my African Water Crisis viz, I wanted to visually represent the substantial difference in access to clean water in Africa compared to the rest of the world. Sure a bar graph or a map would suffice, but I wanted something that would truly drive it home (I mean, this is why we are here, right?). I had seen visualizations previously where people had seemingly “filled different shapes” based on some level of data. As a newbie, I thought “how the heck did they do that?”—a thought that has been a recurring theme for me in this short time. I ultimately learned that beautiful doesn’t mean complicated (but don’t tell my wife that). Let’s dig into the “filled shape chart”.
The Data
The data I used for this viz was lengthy, but very simple. The data showed the percentage of people within each country who have access to clean water. It showed this information for nearly every country between 1990 and 2015. In addition, the data was rolled up to region (Europe, Oceanic, Americas, etc.). For the filled shape chart, I focused solely on the most recent measurements for 2015. The scrubbed data simply showed each region and a total percentage with access to clean water.
The Bar Graph
Previously I said that a bar graph would suffice; well the truth is that it is the basis of the filled shape chart (though other charts can be used as well and I’ll mention this later in this blog). So let’s start by creating a simple bar graph. I changed the background to black and since I was dealing with water, I changed the color to blue. I removed all grid lines to make it a bit cleaner, but I did keep the axis labels for ease of reading. The bar graph by itself looked pretty good:
The Bottle Shape
So how do we turn a simple bar graph into a filled shape chart? Okay, this is the critical point in this entire process. Please be prepared. Are you ready? Okay. Just stick an image on top of the bar graph. What????!!!! Yeah, just overlay an image with a transparent center on top of the image to look like it’s filled. This was a total buzz kill for me. In my brain, I wanted it to be more complicated. I wanted it to involve some crazy Tableau trick that would literally fill the shape–some magic formula. I felt like I did when Ken and I were kids and we learned that a piece of PVC pipe slid onto a hose that was strung between two trees two stories high did NOT make a good zip line (ask Ken about that sometime). But, though somewhat disappointing, it was a complete aha moment. The truth is that it’s simple and doesn’t need to be complicated. And once I learned that, I started thinking about all the applications for this type of work (and there are a lot of them).
First, find a great image. Make sure the image is not grainy and be sure that the lines are very clean. Try to select an image with a single-color background (no shadows or gradient colors). You can even try to find images with transparency already built in (though that can be difficult). Through some web searches and after fiddling around with several images, I decided on the following water bottle:
This image had white background and black bottle outline. My viz utilized a black background with white lettering so I changed the bottle to have a black background and white outline.
As mentioned previously, you will need to make the inside of the image (in this case a water bottle) transparent. On his website, Josh Tapley shows us how to create transparency in images quickly and easily using PowerPoint. For the filled shape chart, instead of making the background transparent like Josh shows us, we need to make the inside of the image transparent so the bar graph will show “through” the image. For my bottle, I utilized this method to make each segment of the inside of the bottle transparent. When working on your image, be sure to leave the background opaque (for some reason I was always confused as to exactly what opaque meant, but ultimately it just means NOT transparent). The background will also need to be the same background color of your dashboard. The reason it will not be made transparent is because you want it to actually block out any extraneous parts of the bar graph—without an opaque background, I would have had part of the bar graph peeking out from the curved bottom of my water bottle.
The finished product looked like the following, with black background, white bottle outline, and transparent center.
Raising the Bar
From here, it's easy. You add your bar graph to the dashboard, then add the image to your dashboard. Move and resize the image to fit nicely over the bar graph so that only the bar shows within the image itself—this may take a bit of tinkering with the image size/position and bar graph size/position. See below:
From here, it's easy. You add your bar graph to the dashboard, then add the image to your dashboard. Move and resize the image to fit nicely over the bar graph so that only the bar shows within the image itself—this may take a bit of tinkering with the image size/position and bar graph size/position. See below:
Overlay the image:
Resize and position the image:
Repeat this process until all bar graphs are covered and aligned (Tip: Use the Layout panel to adjust the position of each shape). The result is a bar graph with flair. Compare the two options bellow. Sure the bar graph would work, but the bar graph with overlaying water bottles (filled shape chart) sure gives your visualization a big kick in the pants.
Original Bar Chart
Updated Filled Shape Chart:
As I mentioned earlier, once you realize the secret behind this, you will start to see applications for it on a regular basis. Simon Beaumont just recently did this with his Makeover Monday gender equality visualization.
And it’s not limited to just bar graphs—you can do it with all kinds of other charts such as a pie chart (donuts just so happens to be the subject of my next visualization).
Well there you have it…my first blog. And since you’re reading this, it means you made it all the way to the end (hooray for me and especially you!). I hope this Tableau newbie was able to provide a tiny bit of insight into the filled shape chart. And by the way, Ken Flerlage rocks!
Kevin Flerlage, April 7, 2018
Really excellent 1st Blog! The wheels are starting to turn...
ReplyDeleteAwesome trick.
ReplyDeleteHi, when you say you changed the bottle to have a black background and white outline... did you mean you changed the actual image itself or you changed the background and outline of the first image within tableau ?
ReplyDeleteChanged the image itself.
DeleteHi Ken, how to add dashboard action to the water bottle
ReplyDeleteHello. What specifically are you trying to do with the dashboard action and water bottle. Can you expound upon this?
DeleteHow did you make colored background and transparent center for the picture? I can;'t find a way to have both. I;ve spend more than 5 hours on this. Can you help me? Thank you!!!
ReplyDeleteRodo, I show how to do this exact thing in the following blog post: https://www.flerlagetwins.com/2018/11/tableau-powerpoint-match-made-in-heaven_34.html. In that blog post, there is a youtube video. I explain how to do what your asking beginning 15:55 into the video. Let me know if you still have questions. Thanks!
DeleteKevin
I know this is an older post, but I can't get any file format to be accepted by tableau. Did they take this feature away? Or what file format do you use for the image? Thank you!
ReplyDeleteI think I need some more information as this should still work fine.
DeleteHello team , Is there a way to fill shapes inside worksheet instead of shapes overlay on the dashboard ?
ReplyDeleteYou can, it's just a bit of a pain. You can use a dual axis - one with a bar and one with the shapes. It's just a lot harder than it should be. One other option you could try is map layers.
Delete