My latest instalment of Tableau tips is all about maps. Here are 10 tips for creating different map styles in Tableau.
10. Remove map layer
An easy way to create a clean map for your visualisation is removing the map layers. Select Map on the toolbar and "map layer". Then untick everything in the map layers window. This will leave only the outline of the map data.
9. Change map border colours
When using a map, you can change the border colours under Colour. Select Colour and choose the border colour you want.
8. Create US map outline
Combining Tip #10 and #9 and removing the fill colour, we can create a map outline. First remove the map layer (tip #10) and then set the map fill colour to match the background colour. Then colour the borders in the desired colour (tip #9). We now have just an outline of the map.
7. Create a minimalistic map
I first posted about this here. By removing the base layer (similar to tip #10), we can change the Pane colour to change the water on the map to any colour. Once the base layer is unchecked, simply right-click on the map and select "Format", then select "Shading" and change the "Pane" to the desired colour.
6. Countries of the world outline
Similar to tip #8, we can create an outline of the countries. In this example, I also combined tip #7 to change the pane colour to match. This creates a red outline of the countries on a completely black background.
5. Add map gridlines
Right-click on the map and select “Format”. Then select gridlines for the rows and columns, and change to the desired colour and transparency.
4. Data layer as map background
Tableau has built-in data layers for the United States. By adding custom colours in the preference file, we can use these as background colours. I have created a "black to black" colour in the preference file. This allows me to use population at the level of state, using "black to black" as the colour scheme to colour everything black, then applying tips #10 and #7 to create a minimalistic map with dots.
3. Dual-axis map alternative
First we build our map with sales by city. Then duplicate the longitude on the columns. On the first Longitude pill, remove everything except state. Then change fill colour and border colours to black. On the second Longitude pill, change the colour to the desired colour and transparency. Remove the map layers (tip #10) and then change the Pane background colour (tip #7).
2. High contrast maps
Tableau has three base map options; normal, light and dark. These maps are well done, but oftentimes don't have enough contrast. This is especially the case when projecting on screens using various projectors. One option is to use Mapbox maps, and there is a high contrast option that is one of the defaults in Mapbox. You can also create your own custom maps in Mapbox.
However, there are a few alternatives for doing this in Tableau without the need for Mapbox. I posted one alternative method here, but this only works where there is a data layer available. Here is another alternative that can be used for any map and can be used to create high contrast for both light and dark maps.
The key is to remove the base layer and change the background colour of the pane, as we did in tip #7. The difference in this case is that we keep the streets and highways ticked under the map layers (and land cover, if desired). For a light map with dark streets, choose the "dark" map style and set the pane to white or another light background colour.
For a dark map with very light streets, choose the "light" or "normal" map style and set the pane colour to a dark or black background.
1. Create a new map style in the TMS
You can add a new map style to your TMS to use the style over and over and make it even easier to use.
IMPORTANT: Change the inline="true" in the opening lines of your TMS file if you want your new custom map style to save in your Tableau file or on Tableau Public. <mapsource inline="true" version="10.0">
Below is a sample map style for you to copy and paste into your TMS file. Then open Tableau, create a map and this new map style, "Dark Contrast", should appear in your list. Untick Base and set the other map layer options as desired.
This map sets a dark background using <map-layer-style name="background_color" request-string="#000000"/> and combines that with the other elements of the "normal" map using "from=tableau4_2_water" and "from=tableau4_2_landcover". When the "base" map layer is unticked, the resulting map will look similar to the map below.
I hope you find these tips helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com