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

Presidential Election Map (Choropleth)

Hi I’m new to
For learning, I’m looking for a US Choropleth Map that is has degrees of Red or Blue given votes for Dems or Republicans.
Does a example of this exists in a jupyter notebook using pandas?
Much appreciation in advance

Hey @grahama1970,

Glad to hear you’re learning plotly :slight_smile:

The choropleth example ( uses pandas to read a csv file to a dataframe ( You can download the choropleth example directly from the former link (download button in sidebar).


Hi Branden
In the election case, how would you color the states from Red to Blue? Is there a plotly tutorial which gives insights in this direction? My actual problem is a bit more complex, the below is a bit of a starting point :slight_smile:
State | Dem-Count | Republican-Count
CA | 245 | 10
State of California shows Red

Is it possible to use a custom shape file for a choropleth? I need to use an electoral college map. Digging around the the discussion forum suggests the answer is no. Can you clarify?