import all plotly liberaries
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.tools as tls
df.head()
set credentials for plotly account
tls.set_credentials_file(username=‘xxxx’, api_key=‘xxxxxxxxxxxx’)
signin to plotly account using username and api_key
py.sign_in(username=‘xxxx’,api_key=‘xxxxxxxxxxxxxxx’)
tls.set_config_file(plotly_domain=‘https://plotly.com’,
plotly_streaming_domain=‘https://stream-plotly.com’,
world_readable=False,
sharing=‘private’)
data = [dict(type=‘choropleth’,autocolorscale=False,locations=df[‘index’],z=df[‘Conversion Active’],locationmode=‘world’,text = df[‘Text’],colorscale=‘custom-colorscale’,
colorbar = dict(title = ‘conversion rate’))]
layout = dict(title =‘rate’,geo = dict(scope=‘world’,projection = dict(type=‘equirectangular’),showlakes =True,
lakecolor = ‘rgb(66,145,245)’,),)
fig = dict(data=data,layout =layout)
py.iplot(fig,filename= ‘choroplet-map’)