Explore Data Geographically
After completing this unit, you’ll be able to:
- Describe how to use a geographical field to build a map.
- Understand what kinds of questions maps can help you answer.
Mapping with Tableau
So far, you've built some great visualizations that allow you to analyze sales over time and by product, as well as to compare sales and profits across categories. After examining product sales and profitability in the South region, you decide to look for trends and patterns in that area.
Since you’re looking at geographic data, you have the option to build a map view. Map views are great for displaying and analyzing this kind of geographic information.
Tableau recognizes a lot of common geographic data, such as state and city names. When Tableau recognizes this type of data, it automatically assigns fields appropriate geographic roles, so they become geographic fields.
Geographic fields have globe icons next to them in the Data pane. If a field is assigned a geographic role, Tableau automatically creates a map view when you add it to the sheet. If Tableau doesn't recognize your data as geographic, you can manually assign a geographic role to each of the relevant fields as mentioned in Data Connection in Tableau Desktop.
There are many geographic roles to choose from. Here is just a sample.
- Area Code
- Congressional District
- ZIP Code/Postcode
When your data has a geographic field, several things happen.
- The field gets added to a Marks card. In the case of a data set that has state and country in hierarchical order, both fields are added.
- Tableau automatically creates a map visualization with Latitude and Longitude in the Columns and Rows shelves. You can think of latitude and longitude as X and Y fields. They’re essential anytime you want to create a map view, because each location in your data is assigned a latitudinal and longitudinal value. Sometimes the latitude and longitude fields are generated by Tableau. Other times, you might have to manually include them in your data.
Build a Map View to Answer Geographic Questions
You might use a map to help answer questions such as, Which regions in the US have the highest obesity rates? Or, Which states have the most coffee shops? Or, Which states have the most sales and profits in the South region?
Look at this map view with Country and States.
In this example, there is a mark for each of the 48 contiguous states in the US (The Superstore data set doesn’t include Alaska and Hawaii.)
Notice that the Country field is also added to the view. This happens because the geographic fields in Superstore are part of a hierarchy. Each level in the hierarchy is added as a level of detail, like layers of an onion.
Focus the Map View
Most times, a simple map view is not enough. You need to add a focus, like:
- Marks to indicate value.
- Color to differentiate between higher and lower performing areas.
This is all possible. Let’s check it out!
Build a Map View
In this simulation, you build a symbol map to show geographic distributions of data in your data set. You use your CompanyOrders dataset to create a map that shows which US states had the most sales and profit.
- Launch Trailhead Simulator.
- Ensure you’re in the Build a Map View simulation.
- Click Begin.
- In the open worksheet, drag State into the view. Tableau generates the latitude and longitude fields on Columns and Rows since the State field was geocoded. Now that you have generated a map, check which US states had the most sales.
- Drag Sales to Size on the Marks card.
- Increase the size of the circles so it’s easier to see which states had the most Sales. Click Size on the Marks card.
- Click the slider to get the desired size. Notice that the size of the marks has increased. A symbol map is perfect here because the circles in the view standardize how the data is shown, and you don’t get a biased view of sales based on the relative size of the states. Instead, you are focusing on the size of each circle. It’s not a good idea to put a measure with potentially negative values on Size, because it’s not immediately clear whether a mark with a negative number is positive or negative.
- Click anywhere to continue.
- Drag Profit to Color on the Marks card.
- You want the marks to be more prominent by adding a border around them. Click Color on the Marks card.
- Next, click the Border dropdown.
- Select Black. This makes the circles stand out more from the gray map image. Notice that all the marks now have a distinct border around them.
- Click anywhere to continue. You can also adjust the background settings on your map.
- Click Map from the application menu, then click Background Maps.
- Select Normal. Notice how the view changes.
- Click Map again, then click Map Layers. The Map Layers pane appear on the left panel.
- Deselect Land Cover.
- Select Coastline. You can see how the map view changes with each selection.
- Click Home to restart the activity or Exit to continue.
You just created a symbol map that shows which US states had the most sales and profit. You used both size and color, and applied formatting techniques. Remember that symbol maps are useful here because the circles in the view standardize how the data is shown, and you don’t get a biased view of sales based on the relative size of the states.
In this module, you learned how to create a line chart, bar chart, scatter plot, and map using Tableau Desktop. Those are just a handful of the visualizations you can build with Tableau.