Online tableau training, tableau tips, & video tutorials

# Exercise: Dual-Axis Map in Tableau

Preview

Instructor

Ryan Sleeper

### Combine a symbol map with a filled map

In this self-guided exercise, you will create a symbol map at the City level of detail and a filled map at the State level of detail; then combine the maps into a dual-axis map so one layer covers the other.

Hi, this is Ryan with Playfair Data TV. And in this video, in this self-guided exercise, you’re going to be recreating a dual-axis map in Tableau.

So go ahead and look at the screen here. This is the challenge for you here. There’s lots of hints on the screen itself. On one axis we have a filled map that’s colored by region at the state level of detail. On the other layer, we have a different type of map. It’s a symbol map. Those circles are sized by their sales values, and we’re using a different level of detail– city level of detail. So notice on the bottom layer it’s a filled map at the state level of detail, and on the top layer it’s a symbol map at the city level of detail.

Take a shot at that, pause the video. When you’re ready for me to come back and explain it, just hit the Play button, and I’ll show you how I would approach this particular chart type.

All right, so let’s see how this was done. The order doesn’t matter at all, but I would probably try to create what I think is the slightly more difficult map to create, which would be the symbol map sized by sales at the city level of detail.

So over here in Tableau, I know that to create a symbol map– to start the map, all I have to do is double-click on a field that has a globe icon next to it. If you don’t see a globe icon in your data set, I encourage you to review the video An Introduction to Mapping in Tableau. I show you how to reassign geographic roles, which is a common pitfall or something you might come across in your own data set.

But we’re just using the Sample Superstore data set that comes with Tableau, so I admit it’s already been kind of organized for us, it’s very easy to work with. So to start my map, all I have to do is double-click on the City field.

And if I click on that, because my data set is already organized into a hierarchy, I get the city as well as the state. So Tableau is able to make those pairings between city and state and draw a circle for all of our cities on the view. So so far so good.

And again, I’m walking you through this because in a real life scenario, state might not come over with the field if you haven’t established a hierarchy, so you’re going to see a lot of unknown values. Tableau is confused– it doesn’t know which city goes with which states until both of those fields are used together. So if I re-add state to detail, that notification goes away, we’ve got a circle for all of our cities.

Now all that’s left on this first map is to encode those circles by some type of measure. And in our exercise, what we were doing is sizing those circles by their sales values. So I’m just going to drag the Sales measure to the Size Marks Card. I’ll make these a little bit bigger so that we can see them. But that is essentially the first map. We’re going to come back to it and edit the format a little bit once we combine the layers so that we can see the circles better, but for now we’re going to call that good.

To create my second layer, I need to either duplicate the Latitude pill on the Rows Shelf or the Longitude pill on the Columns Shelf. The only difference is one version of this will give us two maps on two rows if we were to duplicate the Latitude pill on the Rows Shelf. The other version would give us the same map on two columns if we chose to duplicate the Longitude pill on the Columns Shelf. It really doesn’t matter, it’s a personal preference. For whatever reason I tend to duplicate the Latitude pill on the Rows Shelf.

There’s a shortcut to doing this. If you hold the Control key while you click the Latitude pill and drag it right next to itself, it creates a copy. It’s one of my favorite shortcuts in Tableau, but if that’s uncomfortable or you’re not used to doing it that way, another option for you is to simply look up the Latitude pill in the Measures area of the Data pane and drag that onto the Rows Shelf for a second time. Either way, we get to the exact same place.

What’s important so far, though, and why we duplicated that Latitude pill on the Rows Shelf, is now that we have two pills on the Rows Shelf– two measures, to be specific– they each get their own set of Marks Shelves or Marks Cards that we can edit independently. This means we can leave the first row as is, but on the second row, we can make some changes to it.

The first thing is we no longer need the Sales measure– we’re not sizing the circles by anything, so we’re going to drag Sales away. Also if we look back at the exercise, that bottom layer, the filled map is at a different level of detail. It’s at the state level of detail instead of the city level of detail. So I will remove the City dimension from that set of Marks Cards.

So notice that second layer is changing, the bottom rows changing. The first map is exactly how we started, it’s remained unchanged. We’re editing these independently of each other through the Marks Cards. Another option for you on these Marks Shelves is to change the mark type. On the second row, instead of using a mark type of Circle, which generates a symbol map, I will use this dropdown and change it to Map, which will give me a totally different type of map on each of these rows.

And then the last thing, to encode those filled polygons on the second map by region, I’m just going to drag the Region dimension to the Color Marks Card.

So at this point we have two maps that have been built independently of each other. On the top row we have a symbol map at the state level– or sorry, at the city level of detail. Those circles are sized by their sales values. On the second map we have a filled map at the state level of detail, and those polygons are encoded by color, and they are colored by the region that they are in.

So two completely separate maps. To finalize the exercise, I’m going to combine these into a dual-axis map, which you can do by clicking on the second pill and clicking Dual Axis, the third option down. This makes the second layer lay on top of the first layer. It’s close, this looks OK, but there’s one little issue I’m seeing– those gray circles are laying underneath our filled in polygon map, so they’re a little bit hard to see.

To reorder those, all you have to do is drag one of these pills in front of the other. So if I drag the second occurrence of the Latitude pill in front of the first occurrence, my layers will be reordered, you see those gray circles emerge to the forefront above our polygon layer.

That’s better, but that contrast still isn’t strong enough, the grays are too close to the blues. So I might also make one more change– again, these maps are still independent of each other. So I can navigate to the Marks Shelf for the Circle mark type, which is my symbol map. And I’ll click on the Color Marks Card to give these a better contrast. I’ll choose white as the color. There’s an effect for a border if you want to make those pop even more. I can add a black border, for example. And I’ll also increase the size just a touch so those circles stand out even more.

But this is a dual axis map in Tableau. We’ve just taken two totally separate maps and then we’ve combined them into one layer.

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