The color palette used for the risk factor and social determinants of health maps is the “viridis” color palette. It was specifically designed to better indicate color differences and be colorblind-friendly than most plotting default color schemes (viridis debut in 2015).
show_col(viridis(6))
show_col(viridis(25))
This web tool allows you to generate hex codes using the viridis palette for any number of categories. The lightest color will always be #FDE725 and the darkest will always be #440154, and the colors in between are found based on the number of categories. The colors generated by this tool are the same ones generated inside of R or Python when using the viridis palette.
In Stata, this package may be a way to add the viridis scheme without having to do it manually, but I did not test it.
Viridis is well-integrated with R. The viridis package allows you to generate color palettes in R based on the viridis scheme. The package also includes several other palettes that are colorblind-friendly and have similar characteristics to viridis.
In the leaflet package for creating maps, all of the color palette functions allow viridis to be specified as the palette. This page describes generally how to use colors in leaflet maps.
Viridis can also be used easily in ggplot visualizations. See this page to learn about using viridis in ggplot2.
Author: Matthew Voss
Date Created: 8/9/2021