Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Save interactive choropleth as HTML file

how we can save interactive choropleth graph as html page in python ? I am using plotly and cufflinks to plot interactive choropleth graph.

Here is sample code.

import plotly.plotly as py
import plotly.graph_objs as go
import pandas as pd
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

import cufflinks as cf



data = dict(
type = ‘choropleth’,
locations = [‘AZ’ , ‘WA’, ‘CA’],
locationmode = ‘USA-states’,
colorscale = ‘Greens’,
text = [‘Arizona’, ‘Washington’,‘California’],
z = [1.0,2.0,3.0],
colorbar = { ‘title’ : ‘Colorbar goes here’ }

layout = dict (
geo = {‘scope’ : ‘usa’}

choromap = go.Figure(data = [data] , layout = layout)


Now, how can I save this interactive graph as HTML file where I can also play around data and do all other things which can be done in notebook.