Learn how to make several of the most effective types of maps in Tableau. Ryan also discusses some of the intricacies of Tableau maps, common pitfalls you may encounter in your own data, and a real-world application of dual-axis maps.
Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to be providing an introduction to mapping in Tableau. I’m going to show you how to make a symbol map, how to make a filled map, how to combine those two types of maps into what’s called a dual-axis map. And we’ll also talk about some of the common pitfalls you might run into, such as what to do if Tableau doesn’t recognize any of your fields in the data as being geographic and how to handle null values on a map.
To start with, over here in Tableau Desktop, I’m going to just double-click on a field that has a globe icon next to it. That’s Tableau telling you that it recognizes that field as being geographic.
Mapping in Tableau is one of the most underappreciated technical features that I can think of. It really is amazing how easy it is to create a map. As long as you’ve got a field that Tableau recognizes as being geographic, it can create a map for you.
Without Tableau, if you had to use a different software program, for example, this typically takes some type of additional licensing to unlock all those latitude and longitude pairs. So this is extremely valuable. Super easy to setup a map. If you see a globe icon next to a field, just double click on it. And you have the first type of map.
This is called a symbol map. From here, I can modify these symbols or encode those values by different fields. For example, if I wanted to size each of these circles by their sales values, I could drag the Sales measure to the Size marks card.
Now, the larger the sales, the larger the circle. The smaller the sales amount, the smaller the circles. I’ll click on the Size marks card again and drag this over to the right a little bit just so that we can see those a little bit better.
I can also encode these marks by color. So maybe instead of sizing by Sales or in addition to sizing by Sales, I’d want to color these circles by their profit values. If I drag Profit to the Color marks card, you’ll see now that the higher the profit values, the darker the blue. The lower the profit values, the darker the orange.
So we’ve just added some additional context to these marks. Some of these circles, such as in the state of Texas, were relatively large. But when we encoded it by that second measure of Profit, we can see that while sales were up, profit was actually down.
And that’s the first type of map. That’s called a symbol map. If you don’t see any globe icon next to any of your fields, that means that the underlying data probably wasn’t written in a way that Tableau recognized as being geographic.
For example, if you’re working with states but you’ve got your own internal abbreviations for states, Tableau might not pick that up automatically. However, it’s very, very easy to assign a geographic role to these fields.
So let’s keep going with this example of we’ve got a state field in our data set, but maybe we’re using some of our own abbreviations. And Tableau hasn’t recognized State as a geographic field. This is very common. You might open Tableau and see that you’ve got a geographic field, but it might have an ‘abc’ icon next to it, which tells you Tableau interpreted that field as a string data type.
If you ever need to change a string data type to a geographic role, just right-click on the field. And about halfway down, there is an area called Geographic Role. And if you hover over that, you’ll see all the different geographic roles that you can assign to it.
In this case, I would click State or Province. And then from that point forward, that field would get a globe icon, and you could use it to create this first type of map that I just showed you, a symbol map.
From here, I’m going to show you a technical feature called Map Layers and Data Layers. To get to it, you click Map in the top navigation and click Map Layers.
The first thing I want to point out on this Map Layers pane is there are three different styles that come out of the box with Tableau Desktop. The default is called Light. That’s what we’re looking at now.
It’s very nice. I like this default. I typically go with this. But as the name entails, this is kind of a light colored map.
There’s two other styles in this dropdown. Normal is very similar to Light, but it adds a little bit more depth, a little bit more color. You can see things like the oceans and the land coverage a little bit better with that Normal style.
And then the Dark style is a reverse-contrast style map. As you can see, the background’s now black. Some people like this style. The data points tend to pop off the page a little bit more as long as you have a deep enough contrast between the marks and the underlying map.
But I typically like to go with a light colored map, so I’ll leave that as the default right now. The next section is called Map Layers. This is where you can toggle on different features of the map, things like the base. See how we lost the color in the background there? Land coverage, things like mountain ranges, is what that one does. Everything from land coverage to city names, state borders, ocean borders, all of these things can be toggled on and off in this section called Map Layers.
The next one down is called Data Layer. This is census-type information that comes out of the box with Tableau. It’s a good way to add additional context to your view without having to pull in an additional data source.
So things like population. If I click on Population, now, in our symbol map, we’re looking at not just the Sales by State and colored by Profit. But in the underlying map, those states are now colored by their population.
And you can also change the granularity of these data layers. Instead of by state, you can get quite granular all the way down to the block group. I only ever go as deep as zip code. If I click on that, you’ll see a lot more data points on that underlying map, because we’ve just changed the level of granularity from state population to population by zip code.
So pretty handy feature. This is back by popular demand in Tableau. It went away in one version, but now it’s back. It comes with Tableau Desktop. There’s no additional licensing fee or anything. And again, you can toggle these on and off at your own discretion.
One last thing on a symbol map before I move on. I’m using the Sample – Superstore data set that comes with Tableau. And it’s been kind of nicely organized for you already. I kind of admit that it’s not a true-to-life data set all the time, because it’s already been prepared for you.
And one of the ways this data set has been prepared is there’s a hierarchy for the location. It goes in order from Country to State to City. So if I were to click into this plus sign down to the City level, it will just work for me right away. If this was a real life data set, that hierarchy would not be in there by default. You’d have to set that up.
So I just want to point out this one pitfall. If I were to actually start a new map and just double click on City to start my symbol map, notice that it brings the hierarchy in with it. So we’ve got Country, State, and City.
In real life, however, you likely would not have State or Country carried over. And let’s take a look at how this changes the map.
So we see fewer circles. We also see a notification in the bottom right corner that says 353 unknown values. Let’s click on that and take a look at how we can handle those.
One option is to filter them out completely, but that is not a really relevant use case for us or solution for us, because we want to see all the city names. So let’s ignore that one and click Edit Locations.
This will bring up a little dialog box that shows us what went wrong. Why didn’t it recognize these city names? And all of these are saying Ambiguous. What’s happening is there’s multiple city names. There’s one city name that is relevant in multiple states, I should say.
The example that I like to use is Springfield. There’s a Springfield, Missouri, a Springfield, Illinois, a Springfield, Massachusetts. Tableau, at this point, doesn’t know how to pair that Springfield with the state, because state is nowhere on the view. If I click Cancel out of this and drag State to the Detail marks card, Tableau can then, again, make those connections, those pairings with the city as well as the state. And it’s able to draw all the data points on the view.
That’s the first type of map. That’s called a symbol map. The second type of map I’m going to show you is called a filled map. I’m going to start another map again. And this time, I will just double-click State again. And I’m going to show you a couple different ways to convert the default, which is a symbol map, to a filled map.
The first way is to use this dropdown to choose the mark type. Filled map is actually a mark type. It’s called Map. So instead of using Circle as the mark type, if I just switch this to be Map, you’ll see this converted into what’s called a filled map. Now, instead of seeing a circle at the intersection of the Latitude and Longitude for each state, you see a nice, crisp polygon around the entire state border.
I’m going to hit Undo once and go over here to Show Me and show you that it’s also an option within Show Me. So it’s the second map on the second row.
Notice it’s recommending a symbol map. That’s what that orange box around that thumbnail image indicates. But if I choose the one right next to it, it converts it from a symbol map to a filled map.
Just like a symbol map, I can now encode a filled map. However, the difference is I can only encode it by color. You can’t size these polygons, but you can color them. So if I were to color these states by the region that they’re in by dragging the Region dimension to the Color marks card, you’ll see the four distinct regions represented in this filled map.
The last type of map I’m going to show you in this quick introduction to mapping is called a dual-axis map. We’re going to combine both of these layers. So we started out with a symbol map. I then showed you a filled map. We’re now going to combine those into one so that the maps lay right on top of each other.
I’m going to start this view on the symbol map, because this symbol map was a little bit trickier to create than the filled map. So this is kind of the harder layer to create. We already did it, so I’m going to start with this map.
To start a dual-axis map, the next thing you need to do is duplicate either the Longitude pill on the Columns Shelf or the Latitude pill on the Rows Shelf. For whatever reason, I tend to duplicate the Latitude pill on the Rows Shelf, which you can do by holding down the Control key and clicking on the Latitude pill while you drag it right next to itself. If you don’t quite catch the Control key– that’s just a shortcut that I like to use– you can always look up the Latitude measure in the Measures area of the Data pane and drag that onto the Rows Shelf right next to the first occurrence of that Latitude pill.
Because Latitude is on the Rows Shelf twice, it created the exact same map twice on two different rows. If I were to undo and drag Longitude right next to itself, we would see the same map in two columns. That’s the only difference when you’re starting out.
The only thing that you cannot do is mix the two. So if I accidentally put Longitude on the Rows Shelf next to Latitude, we get a very strange looking map. Not quite what we wanted.
But you could do either one of these– two Longitudes on the Columns Shelf or two Latitudes on the Rows Shelf. Again, like I mentioned, for whatever reason, I usually put Latitude next to itself on the Rows Shelf.
Because we now have two distinct measures on the Rows Shelf, those each get their own set of marks cards over here on the left. So before we drag Latitude next to itself, we just saw one Marks Shelf that would control all the marks on the view. Once I added a second occurrence of the Latitude pill, we see two new marks shelves appear– one for all, controls all the marks, and then we have a second Latitude Marks Shelf.
And these can be controlled independently of each other. So I can leave the first Marks Shelf as is. That’s what controls the marks on the first row or the first map. But on the second Marks Shelf, which controls the marks for the second row or the second map, I can make some changes.
We no longer need Profit, so I’ll get rid of that. If we’re looking back and I’m trying to recreate my filled map on sheet three, we also notice that there’s a different level of detail. On the filled map, we don’t need City. So I’ll get rid of City. And we’re also not coloring or sizing anything by Sales, so I’ll also get rid of Sales.
So notice all these changes that I’m making are affecting the second row, but the first row is still intact. Now, in the second row, I’ll change the mark type from Circle to Map. So at this point, we’ve got a symbol map on top. Those circles are sized by Sales and colored by Profit.
On the second row, we have a filled map at the State level of detail. But we haven’t encoded the marks by anything. If I drag Region onto Color for the second row only– very important. We don’t want to color or change that first row at all. So I’m going to drag Region to the Color marks card, which controls the second row. And as you can see, we’ve now got two completely separate maps developed.
The last thing we’re going to do is combine these maps into what’s called a dual-axis map. And the best way to do that is to click on the second occurrence of either the Latitude pill if you chose to put a second pill on the Rows Shelf or the Longitude pill if you chose to put the second pill onto the Columns Shelf.
In either case, third option from the bottom is called Dual-Axis. And if you click on that, the maps will be combined.
The second layer, by default, lays on top of the first layer. So while this is working, it’s not very easy to read at this point, because we’ve got those blue and orange circles underneath our filled-in polygons. To reorder these layers, all you have to do is drag one of the Latitude pills in front of the other or one of them behind the other, whichever order you want to go in. If I drag this second Latitude pill in front of the first Latitude pill, the layers will be reordered.
I might, down the road, format this a little bit better. We’ve got some very close contrast here with the blues and oranges. But this is what I was looking for.
We just combined a dual-axis map. On the one layer, we had a symbol map with circles that were sized by Sales and colored by Profit. On the second or bottom layer, we had a filled map at the State level of detail colored by what region it’s in. And then we combined the two of these.
This is a really good real-world application, something to use. The best example of this type of map that I’ve seen in practice was with a client of mine that sold their product exclusively online. However, they had competitors that sold their product in traditional brick-and-mortar stores.
So one of the views that we made in Tableau was a dual-axis map just like you’re looking at here, where on one layer, we had a symbol map with the circles sized by our sales in different cities around the country. And on the other layer, we had the brick-and-mortar locations of our competitors.
So we were able to get some very actionable insights from that. We could see things like, are there areas in the country where we’re doing really well and we don’t see any competition from the brick-and-mortar locations? Those markets, we might want to try to corner. We might want to try to keep investing in those markets, because we know we have a head start on our competition.
Or vice versa, are there areas where we’re not doing as well as we typically do, and we can see that our competitor has several brick-and-mortar locations? At that point, we have a decision to make. Do we fight for that market, invest more in it because we know we have steeper competition? Or do we say, we’re going to go ahead and let those markets go. Our competitor is already established. Let’s reinvest somewhere else.
So a really good real-world application. Obviously, we’re just kind of scratching the tip of the iceberg here with mapping in Tableau. Down the road on Playfair Data TV, I’ll be sharing several examples of how to customize these maps– things like mapping a background image, creating custom polygon maps, and creating path maps.
But for now, this has been Ryan with Playfair Data TV – thanks for watching!