Choropleth maps are thematic maps in which areas are shaded based on the prevalence of a particular variable. They are a great way of showing how a measurement varies across a geographic area.
Below is an example of choropleth map showing the rate of excessive drinkers by county. The darker the region, the higher the percentage of excessive drinkers. This makes it easy to pick out certain states as having particularly high rates of excessive drinkers (looking at you, Wisconsin), while others have very low rates (shout out to Utah).
Click Results à la Mode to clone this example and make your own choropleth map. Learn more about using HTML to customize your reports.
Create a choropleth map
Add the stylesheet links and script tags to the top of the HTML:
<link rel="stylesheet" href="https://mode.github.io/alamode/alamode.min.css">
Add the customizable snippet at the bottom of the HTML:
query_name: "Query 1",
title: "Excessive drinking rates",
You can customize the map by editing the parameters in the snippet:
html_element: If not provided, the map will be added as the last element in the report. To place it elsewhere, select an element in your report with this parameter.
width: The width of the map. Defaults to 950. The map will always stay the same ratio.
height: The height of the HTML element containing the map. The map itself will resize according to the width value provided.
query_name: The name of the query that returns the map’s dataset. If you update the name of the query, you’ll need to update it here as well.
county_id_column: The dataset column that returns each county’s FIPS code.
value_column: The dataset column that returns the value that determine how each county is shaded.
title: The map’s title.
color_gradient: A list of colors to show in the map. Colors should be listed from low to high.