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

Presidential Election Map (Choropleth)

Hi I’m new to Plot.ly
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 plot.ly 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 (https://plot.ly/python/choropleth-maps/) uses pandas to read a csv file to a dataframe (http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html). You can download the choropleth example directly from the former link (download button in sidebar).

Cheers,
Branden

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
AZ
TX
etc
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?