How to split values into binned categories for regions and points

In our map templates, when you have a categorical column in your dataset, you can adjust your palette to customize the coloring of your regions or points. On the other hand, when shading numerically, there are lots of options to customize the scale, the colors used, and the map legend.

In this help doc you will learn how to add custom bins to your data to customize the legend and colors of your choropleth maps, as well as to color your point maps numerically. This is useful for when you want to split your data by specific ranges that may not be available through our custom thresholds options or for when you want to map your values to customized categories. Keep reading to learn how to do this.

In this article

How to make custom bins with your data

In this example, we're demonstrating with Google Sheets, but Microsoft Excel has equivalent functions.

    Create a Google Sheet and import your data.

    Separate from the main data, create a lookup style table that outlines the bins you want to create. 
    It should have two columns:
    • one containing the minimum value of each bin (the maximum is taken from the next bin up)
    • one containing the name of the bin as you want it to display in your legend.

    NOTE: Choose your bin values carefully. Uneven or skewed bins can be misleading and can cause particular values to be disproportionately emphasised.

    Add a new column to your main data that will contain your bin categories.

    Create a VLOOKUP function taking the follow form: 
    =VLOOKUP(numeric_value, lookup_table, bin_name_column_index)
    In this example, this reads:

    TIP: Remember to preserve the cell references for your lookup table using $ like in the example above.

    Download your data, merge it into your Flourish map, and bind your bin category column to the Color by binding in the Regions tab.
    Since we're using a categorical color mode, the default colors of your palette might not be suitable for your map. You can change them by either selecting a new color palette, creating your own palette or using color overrides. Read our help doc to learn how to do this.

    NOTE: Remember we're using categorical values. This means that the number formatting options, like dividing values or adding suffixes, won't be available for you to use. You can use Google sheets or other spreadsheet programs to edit your data.

How to use custom bins with your regions

With the "Projection map" template you can color your regions categorically or numerically. Using custom binned values will allow you to further customize your legend.

    To your spreadsheet, add a column with the binned values following the steps outlined here and upload your data to Flourish.
    On the Data tab, bind the column with the binned values to the Colour category setting.
    Sort the legend under  Legend > Custom order override, by entering the names of your bin categories, each on their own line and in the order they should appear in the legend.

How to use custom bins with your points

Unlike regions, points cannot be colored numerically in the “Projection map” template , only categorically. This means that, if you try to add a column with numeric values to the Colour category binding — which connects to the color options —, the template will assign a different hue to each unique value, rather than assigning hues based on a scale.

This can be problematic if you want to color your circles or spikes numerically, but you can bypass this problem by following these steps:

    To your spreadsheet, add a column with the binned values following the steps outlined in the previous section and upload your data to Flourish.
    On the Data tab, bind the column with the binned values to the Color by setting under Points. See the difference between the original data and the binned values.

    Now that the data is in a format that the template can interpret, you can make further edits to your chart to make it look even better. You can edit your color palette and legend, using color overrides.

    TIP: You can use ColorBrewer, a free tool that helps you create map-specific color palettes.

    As an extra step, if you want your legend to be displayed in a band instead of separate swatches, follow the steps in this help doc to create a "fake" legend using HTML.