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.
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
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.
Once you have all the data in your spreadsheet, add your statistical data, and create another column called "Color Value".
To assign colors to your data, select all the cells containing your data, choose "Color fill," and then select "Conditional formatting."
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.
To extract hex color codes for each state, you'll need to add a custom function. Go to "Extensions" and select "Apps Script."
Then, paste the following function and click save:
function getHexColor(cellAddress) {
var mycell = SpreadsheetApp.getActiveSheet().getRange(cellAddress);
var bghex = mycell.getBackground();
return bghex;
}
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.
To populate the entire table with color values, double-tap the small circle in the bottom-right corner of the cell.
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.
Go to "More" and select "Filter." Then, sort the states alphabetically in the "State" column.
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.
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.
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.