Using Maps in Tableau for Improved Spatial Analysis

People love maps in Tableau.  It’s true.  They look cool and plotting data on top of them is even cooler, just check the World Corruption Map here.  Open a copy of the New York Times on almost any given day and you’ll find a map graphic.  Any time you have any data that is related to geography – zip codes, state or city names, addresses, provinces, postal codes, etc. – Tableau is smart enough to figure out the latitude and longitude coordinates for you. And Tableau Maps have a ton of formatting options.  So, let’s dive in!

How to Use Maps in Tableau for Spatial Analysis

1. Drag Longitude out to Columns and Latitude to Rows.  A zoomed-out map of the world is created in Tableau as it waits to know where to plot the data.

2. Drag city on top of the map in Tableau. You’ll see that it zooms to the USA and plots the cities in your data set.  Filter out Alaska and Hawaii.  Hint: You can just hover and then click to exclude a data point.

3. Now drag Order Quantity to the Size shelf.  We can now instantly see where the largest volume of orders is coming from.

4. Now add Discount to the Colors shelf.  This adds more insight.  We can see where lots of orders are coming from but also perhaps where we are leaving money on the table by too heavily discounting.

5. Change the color scale to more clearly emphasize these spots by clicking on the down arrow on the color legend and Editing Colors.

6. Change it to Red-Green diverging and then reverse the scale, as higher discounts should be colored red.

Creating Maps in Tableau

7. If you hover your mouse over the top left-hand side of your map in Tableau, you’ll notice a floating menu appear. You can click this for selecting options, or simply click and drag your mouse over an area to select a group. 

How to Use Maps in Tableau

Tableau Map Zooming

Tableau Maps provide a variety of options for zooming in and keeping only the data you want to analyze. In the floating menu at the top left, there are some buttons that enable you to drill into your map in Tableau.

  • Search (magnifying glass icon) – allows you to type in a location name and it will intelligently serve up where you are looking.  For example, if you only have a Tableau map of the USA, and you type in Paris, it will serve up Paris, Texas, not Paris, France.  If your Tableau map is global, on the other hand, then Paris, France will be what you get.
  • Plus/Minus signs – allows you to zoom in or out of the map in Tableau
  • Pin/Home icon– clicking this will either pin your map in Tableau so that it doesn’t move anymore, or reset it to its original default

The sideways triangle pops out some new options.  In order:

  • Zoom Area – allows you to hover a magnifying glass icon over a particular section on your Tableau map and click to zoom in.  You can also use your scroll bar on your mouse or use the plus and minus signs up above the floating Tableau map menu.
  • Pan – allows you move the Tableau map around, scroll left and right, up and down
  • Rectangular Selection – allows you to drag a square on the map in Tableau and select everything that falls within that square; from there you can keep only those items or exclude them or simply zoom in using the options above
  • Radial Selection – allows you to choose a particular point and then select everything within a radius from that point – want to see how many neighborhoods are within 3 miles of a Domino’s Pizza, use radial selection
  • Lasso Selection – allows you to grab only what you want to see.  The Rectangular and Radial may include data points you don’t want to explore; lasso enables you to grab only what you want, without having to manually click each point.

8. Let’s zoom in on the Northern Colorado/Southern Wyoming region by clicking and dragging a box around that area.  These are now highlighted.  Continue to hover over the area until a box appears and then click “Keep Only.” 

9. The map in Tableau should now zoom in to that area. 

10. Mouse over the cluster of dots to see the average discounts. 

11. Now let’s see what the demographics of these areas look like to determine if discounts like these make sense.

Maps in Tableau

12. Go to the Tableau Map menu and choose Map Layers at the bottom.  This pulls up a number of formatting options that allow you to plot various things on your Tableau map.

13. In our case, we want to add demographics information, so we are going to use the Data Layer option. 

14. Choose the Household Income option.  This now colors the map in Tableau with the median household income.

15. To make the data stand out more clearly, set the By field to Zip Code, and change the Using color field to “Temperature Diverging.”

16. We now see that Cheyenne has a relatively high income (red for hot zones) but we are discounting more heavily there than some of the lower income areas in Colorado.  We are probably leaving money on the table there, and we now have the data to prove it.

17. Now what if we wanted to do other types of formatting to this, like make it a dark background? You could use the Tableau Map Layers menu to change the style to Dark. 

18. There are tons of options with maps in Tableau.  We could spend a whole day just building awesome maps in Tableau.  Explore more of these options on your own.

Maps in Tableau Tutorial

Now, It’s Your Turn to Create Maps in Tableau

The Quality Improvement team is rampaging through the company trying to improve processes and eliminate rework and problems. 

Tableau Map of Where Returns Occured

They come to you (since you are now becoming known as the Tableau guru) and want to see a Tableau map of where Returns occurred.

  1. Bring Latitude and Longitude into the view.  Hint: Longitude to Columns.
  2. Drag Zipcode on top of the map in Tableau.
  3. Filter out Alaska and Hawaii as right now we only want to focus on the contiguous United States.  You can do this by clicking the sideways triangle on the Tableau map and then choosing the dotted square icon.  Now lasso the points on the map in Tableau, right click and choose exclude.
  4. Click the push pin icon to reset the Tableau map view so it’s more focused on what we want.
  5. Make Order ID (Returns) a count and put it on the Size and Color shelf.
    • Hint: You can do this faster by right clicking and dragging it where you want.  A window will pop up asking you to set the aggregation.
  6. Use the Sunrise-Sunset Diverging color scale. Set it to Stepped with 5 steps.
  7. Add Manager name, City and State to the Tooltip. Improve the tooltip formatting.
  8. Name the tab “Returns by City and State.”

Map in Tableau Showing Average Shipping Cost Per State

They also want to see a Tableau map showing avg. Shipping Cost per state.  We’ll make this one a filled map in Tableau.

  1. Bring Latitude/Longitude out.
  2. Drag State on top of the map in Tableau.  Filter out AK and HI.  You can do this easily by bring State to the filter shelf, and then choosing Exclude in the bottom right.
  3. Bring Shipping Cost onto Color.  Set the aggregation to Average.
  4. Change the background color to Dark.
  5. Change the color legend to something of your choosing, like Red.
  6. Change the state outline color to gray.  (Hint: Click the color shelf).  
  7. Format Shipping Cost to be in dollars with no decimal.
    1. Hint: Click the down arrow to Format, ensure your on the Pane tab.  And use Currency (Custom).
  8. Show labels.
  9. Name the tab “Average Shipping Costs by State.”

Map in Tableau Showing Median Age of Buyers in Texas

Finally, they want to see median age of buyers in Texas.

  1. Build a map in Tableau.
  2. Bring State to the Filter shelf and filter to only Texas.
  3. Bring Zipcode onto the Details shelf.  
    • If some zips appear on the Tableau map that aren’t in Texas, right click and exclude them.  The underlying data may have some inconsistencies.
  4. Size by Sales.  Drag your slider to the right a bit so the circles are more visible.
  5. Add a data layer to show median age.  Set it to compute using Zip code.
  6. Add a title with the answer to the question based on your analysis.

Satisfied with the new things you learned about maps in Tableau? We can teach you more through our individual training program or we can train your team with our corporate Tableau classes.