Conditional Formatting in Maps
Intro
After we have built a map in Sigma we often want to format it so that we can compare data points. For instance, showing darker colors in states with higher sales. We’ll show a couple of ways this can be implemented in Sigma.
In this example we will work with a point of sale dataset with sales data and store location.
Setup: Build Initial Map
- Click
Create Child Visualization
- In the visualization tab, click on visualization type selector and select
Map - Point
- Drag the latitude and longitude coordinates into the corresponding fields
- Points should appear on your map, corresponding to the store coordinates
1. Format with Categorical Variable
We can use a categorical variable to change the color of our points. In this use case we will set the color of our ‘store’ points based off of their region.
- Drag the
Store Region
column into the color field. Points should update accordingly. - Use the color palette to modify color scheme
2. Format with Color Scale
Use the color scale feature and a numeric value (usually a continuous variable) to change the color scale of our points. In this example we will use the Sales Quantity
column to display darker colors to stores with more sales.
- In color field, change from ‘Single Color’ to ‘By Scale’
- Drag
Sales Quantity
into our color field- Calculation will default to
Sum
, but you can change the calculation it in the formula bar - Click on the color scale to change the scheme
- Calculation will default to
3. Format Point Size
Use a numeric value to change the size of the points. In this example we will use our Sales Amount
column to change the size of our points.
- Drag your
Sales Amount
into the ‘Size’ field- As before, use the formula bar to change calculation
- Note that you can use both size and color fields in a single chart
4. Format Tooltip
Not quite conditional formatting but we often want to format or add additional information the tooltip. For instance, if you hover one of the points on your map it may only show the coordinates but we can add additional details to the tooltip.
Let’s start by adding in store name and state:
-
Drag
Store Name
into the ‘Tooltip’ field -
By default the calculation will be the count of the
Store Name
column but we can change it to show the name.- Click
Count of Store Name
- In the formula bar use the ListAggDistinct function to get a single store
ListAggDistinct([Store Name])
- Double click on
ListAggDistinct of Store Name
and change name toStore Name
- When you hover over tooltip
Store Name
should now show up as well - Do the same with
Store State
- Click
-
Add in another metric
- Perhaps we also want to add in data on sales
- As before, drag
Sales Amount
into the tooltip bar - Change the formula to suit your needs (median, avg, total, etc)