Black Lives Matter. Please consider donating to Black Girls Code today.

Map with custom choropleth areas

I know the choropleth areas are pre-defined when making maps in Plotly but is there a way to customize the area so that the choropleth functionality applies to it? I want to build a zip code map or district map that does what a state or country map does (ex. interactive features).

1 Like

Old question, recent advance: there’s now a huge mapping addition by @etienne, MapBox based Plotly maps. It can do shapes. Here’s an example for using it: https://plot.ly/javascript/choropleth-maps/#choropleth-map-of-florida-counties-colored-by-political-party

1 Like

I had to do something similar: the goal was to color the shapes according to some value that is a function of user input, like a heatmap. This meant that the grouping of the layers would change depending on the input. My solution (kind of messy, but would love ideas for cleaner approaches) was to dynamically spit out the GeoJSON. Luckily, my shapes are just lat/lon squares, so that part was easy (I didn’t use ScatterGeo because I figured the squares wouldn’t line up just right for any projection). Anyways, code is here: https://github.com/leejt489/solar-reliability-cost-web