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 how many people play college football by state. The darker the state, the higher the percentage of people play college football. This makes it easy to pick out certain states where college football is particularly popular and unpopular.
Click Results à la Mode to clone this example and make your own state choropleth map. Learn more about using HTML to customize your reports.
Create a state 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",
// Options for state_code_type:
title: "College football players per person",
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.
state_column: The dataset column that returns the identifier for each state.
state_code_type: The type of identifier returned in the
state_column. There are three options:
name (the full name of the state, such as Alabama and North Carolina),
letter code (the two-letter postal code, such as AL and NC), and
fips_code (the FIPS code such as 1 and 37).
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.