Visualize Statistics: Multiple Base Colors | Documentation

Welcome to our tutorial on how to create a heatmap with multiple base colors for visualizing state and country-level statistics. While our interactive map customization tool currently supports a single base color, we'll show you how to achieve a more diverse representation of your data using Google Sheets. Let's get started.


  1. First, navigate to the "Data" tab and download the CSV file. If you want to skip ahead, you can expedite the process by making a copy of this template

    Download CSV

  2. Next, import the CSV file into Google Sheets. You can either import the file directly or simply copy and paste the cells into your Google Sheets document.

    Import CSV

  3. Once you have all the data in your spreadsheet, add your statistical data, and create another column called "Color Value".

    Add Data

  4. To assign colors to your data, select all the cells containing your data, choose "Color fill," and then select "Conditional formatting."

    Conditional Formatting

  5. In the conditional formatting side menu, select "Color Scale" and define your minimum and maximum color values. In this example, we'll use green for the lowest value and red for the highest value.

    Color Scale

  6. To extract hex color codes for each state, you'll need to add a custom function. Go to "Extensions" and select "Apps Script."

    Apps Script

  7. Then, paste the following function and click save:

    function getHexColor(cellAddress) {
     var mycell = SpreadsheetApp.getActiveSheet().getRange(cellAddress);
     var bghex = mycell.getBackground();
     return bghex;
    }
    

    Custom Function

  8. Return to your spreadsheet and refresh the page. To use the custom function, type the function name followed by the cell you want to find the hex color value for. For example, if you want the color value for cell C2, use the formula "=getHexColor(CELL("address", C2))" and press enter.

    Use Function

  9. To populate the entire table with color values, double-tap the small circle in the bottom-right corner of the cell.

    Double Tap

  10. To prevent color values from changing when you filter the table, copy and paste them into the same column but select "Paste values only." This ensures they remain static.

    Paste Values Only

  11. Go to "More" and select "Filter." Then, sort the states alphabetically in the "State" column.

    Sort Alphabetically

  12. Return to your Simplemaps online customization tool. Go to the "States" tab and click the "State" column to arrange the values alphabetically. Finally, copy and paste the "Color Values" column from your spreadsheet into the "Color" column in the online customization tool.

    Paste Color Codes

  13. That's it! You have successfully created a heatmap with multiple base colors. In this example, higher values are represented with colors closer to red, while lower values are closer to green.

    Final Result


If you encounter any difficulties or have questions, please don't hesitate to reach out to us at [email protected]. Our dedicated support team is here to assist you.

Home | License | Privacy | Releases | Testimonials | Resources | Documentation | Order Lookup | All Maps | FAQs
Formerly FlashUSAmap.com and FlashWorldMap.com
SimpleMaps.com is a product of Pareto Software, LLC. © 2010-2025.