Create Dual-Axis (Layered) Maps in Tableau

This article demonstrates how to create dual axis (layered) maps in Tableau using several examples. A dual-axis map is a map with two sets of geographic data overlaid on top of one another. For example, a filled map of US states with data points for each city layered on top.

There are three ways to create a dual-axis map in Tableau:

Follow the steps below to learn how to create a dual-axis map using each of these methods.

Create a dual-axis map from Tableau Latitude (generated) and Longitude (generated) fields

  1. Open Tableau Desktop.

  2. In the Connect pane, under Saved Data Sources, connect to the Sample-Superstore data source.

  3. In the Data pane, under Dimensions, double-click State.

    A map view is created.

  4. On the Marks card, click on the Mark Type drop-down and select Map.

  5. From the Data pane, under Measures, drag Sales to Colour on the Marks card.

    The map updates to show the sum of sales by state. The states with higher sales are darker blue, and the states with fewer sales are lighter blue.

  6. On the Columns shelf, control-drag (command-drag on a Mac) the Longitude (generated) field to copy it, and place it to the right of the first Longitude field.

  7. On the Marks card, select the top Longitude (generated) tab.

  8. From the Data pane, under Dimensions, drag Region to Colour on the Marks card.

    The map view on the left updates.

  9. On the Columns shelf, right-click the Longitude (generated) field on the right and select Dual Axis.

    The map views are now overlapping each other. You might not be able to see the map on the bottom layer.

  10. On the Marks card, ensure that the bottom Longitude (generated) tab is selected, and then click Colour > Edit Colours.

  11. In the Edit Colours dialog box that opens, click the Palette drop-down, select Grey, and then click OK.

    Notice that the colours of the map update.

  12. On the Marks card, click Colour again.

  13. In the Colour pop-up dialog box, under Opacity, move the slider to approximately 75%.

The dual axis (layered) map is now complete. For each region, you can now see which states has the most sales.

Tip: To change which map is on top, rearrange the Longitude (generated) fields on the Columns shelf.

Create a dual-axis map from custom latitude and longitude fields

If your data source contains custom latitude and longitude fields, you can use them instead of the Tableau Latitude (generated) and Longitude (generated) fields to create a dual-axis map. Follow the steps below to learn how.

  1. Open Tableau and connect to a data source with custom latitude and longitude values.

  2. Navigate to a new worksheet.

  3. In the Data pane, right-click the custom latitude field and select Geographic Role > Latitude.

    Note that the Latitude geographic role may already be assigned to the field.

  4. In the Data pane, right-click the custom longitude field and select Geographic Role > Longitude.

    Note that the Longitude geographic role may already be assigned to the field.

  5. From the Data pane, drag the custom latitude field to the Rows shelf.

  6. From the Data pane, drag the custom longitude field to the Columns shelf.

  7. From the Data pane, under Dimensions, drag a geographic field to Detail on the Marks card.

    In this example, the geographic field, Country (Name), is used.

  8. On the Marks card, click on the Mark Type drop-down and select Map.

    The map updates to a filled map.

  9. On the Rows shelf, Ctrl-click (Command-click on a Mac) and drag the custom latitude field to the right. This copies the field.

    A second, identical map is created and the Marks card updates to include three tabs. The middle tab is for the top map, and the bottom tab is for the bottom map.

  10. On the Marks card, click on the bottom tab and remove the geographic field by dragging it off.

  11. From the Data pane, drag a new geographic field to Detail on the Marks card.

    In this example, Airport (City) is used.

  12. On the Marks card, click Colour and select a colour for the marks. In this example, the colour orange is used.

  13. On the Rows shelf, right-click the custom latitude field on the right and select Dual Axis.

    The two maps are now combined.

 

Create a dual-axis map from a combination of generated and custom latitude and longitude fields

Follow the steps in each scenario to learn how to create a dual-axis map from generated and custom latitude and longitude fields.


Best practices for creating dual-axis maps with two sets of latitude and longitude fields:

  • The Latitude(generated) and Longitude(generated) fields must be placed on the Columns and Rows shelves.

  • The custom latitude and longitude fields must be placed on Detail on the Marks card, and then converted to dimensions. For more information, see steps 11 and 12 in Scenario 1.

  • The custom latitude and longitude fields must be assigned the Latitude and Longitude geographic roles. For more information, see Assign Geographic Roles.

  • When joining data sources, use a Full Outer join. For more information, see Join Your Data.


Scenario 1: Use generated and custom latitude and longitude fields from a single data source

  1. Open Tableau Desktop and connect to a data source.

    In this example, an excel spreadsheet that contains country and city names, as well as custom latitude and longitude columns for airport locations around the world, is used.

  2. Navigate to a new worksheet.

    Notice that, in the Data pane, under Measures, there are two sets of latitude and longitude fields: the custom latitude and longitude fields from the data source, and the generated latitude and longitude fields that Tableau creates from your geographic fields.

  3. From the Data pane, under Measures, drag Longitude(generated) to the Columns shelf.

  4. From the Data pane, under Measures, drag Latitude(generated) to the Rows shelf.

  5. From the Data pane, under Dimensions, drag a geographic location to Detail on the Marks card.

    In this example, Country (Name) is used. A map view with a data point for every country in the data source is created.

  6. On the Marks card, click the Mark type drop-down and select Map.

  7. On the Rows shelf, Ctrl-click (Command-click on Mac) and drag the Latitude(generated) field to the right. This copies the field.

    A second, identical map is created and the Marks card updates to include two tabs labelled Latitude(generated). The top tab is for the top map, and the bottom tab is for the bottom map.

  8. On the Marks card, click the bottom Latitude (generated) tab and remove Country (name).

  9. From the Data pane, under Measures, drag the custom Latitude field to Detail on the Marks card.

  10. From the Data pane, under Measures, drag the custom Longitude field to Detail on the Marks card.

  11. On the Marks card, right-click the custom Latitude field and select Dimension.

  12. Repeat step 11 for the custom Longitude field.

  13. On the Marks card, click Colour and then select a new colour.

    In this example, the colour orange is used.

  14. On the Rows shelf, right-click the Latitude(generated) field on the right and select Dual Axis.

    The two maps are now combined. You can filter the view as needed or zoom in to a particular area.

Check your work! Watch steps 2 - 14 below:


Scenario 2: Join spatial data with an independent data source and plot the data from both on the same map

  1. Open Tableau Desktop and connect to spatial data. For more information, see Connect to spatial files.

    In this example, a shape file with polygon data for US states is used.

  2. On the Data Source page, in the Connections pane, click Add.

  3. Connect to another data source.

    In this example, an excel spreadsheet with custom latitude and longitude columns is used.

  4. Join the new data source to the spatial data using a Full Outer join. For more information on how to join data, see Join Your Data.

    In this example, the excel spreadsheet is joined to the shape file using columns that contain state names from each data source.

  5. Navigate to a new worksheet.

    Notice that, in the Data pane, there are two sets of Dimensions and two sets of Measures: one for each of your data sources.

  6. From the Data pane, under Measures, drag Latitude(generated) to the Rows shelf.

  7. From the Data pane, under Measures, drag Longitude(generated) to the Columns shelf.

    A blank map is created.

  8. From the Data pane, drag either the Geometry field from your spatial data source, or a geographic field from your excel data source, to Detail on the Marks card.

    The field you choose is for your bottom layer of data. For example, if you have polygon data in your spatial file, use the Geometry field so that the bottom layer will be filled polygons. If you have linear geometries in your spatial file, use a geographic field from your excel data source and format the map to be a filled or point map.

    In this example, the Geometry field from the shape file is used. The map updates to a filled map of the United States.

  9. On the Rows shelf, Ctrl-click (Command-click on a Mac) and drag the Latitude (generated) field to the right. This copies the field.

    A second, identical map is created and the Marks card updates to include two tabs labelled Latitude(generated). The top tab is for the top map, and the bottom tab is for the bottom map.

  10. On the Marks card, click the bottom Latitude (generated) tab and remove the geographic field.

    In this example, COLLECT (Geometry) is removed.

  11. In the Data pane, under Measures, right-click the custom latitude field and select Geographic Role > Latitude. For more information, see Assign Geographic Roles.

  12. In the Data pane, under Measures, right-click the custom longitude field and select Geographic Role > Longitude.

  13. From the Data pane, under Measures, drag the custom latitude field to Detail on the Marks card.

    In this example, the custom latitude field is named Y.

  14. From the Data pane, under Measures, drag the custom longitude field to Detail on the Marks card.

    In this example, the custom longitude field is named X.

  15. On the Marks card, right-click the custom latitude field and select Dimension.

  16. Repeat step 13 for the custom longitude field.

  17. On the Marks card, click Colour and then select a new colour.

    In this example, the colour orange is used.

  18. On the Rows shelf, right-click the Latitude(generated) field on the right and select Dual Axis.

    The two maps are now combined. You can filter the view as needed or zoom in to a particular area.

Check your work! Watch steps 1- 18 below:

See Also

Build a dual-axis map from spatial data

Join Your Data

Spatial File

Assign Geographic Roles

Thanks for your feedback!Your feedback has been successfully submitted. Thank you!