import chart_studio.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
import pandas as pd
import os
path = "C:/Users/HP/Documents/Python Anaconda/Python for Data Science and Machine Learning Bootcamp/Refactored_Py_DS_ML_Bootcamp-master/09-Geographical-Plotting"
os.chdir(path)
df = pd.read_csv('2014_World_GDP')
df.head()
data = dict(type = 'choropleth',
colorscale = 'Greens',
locations = df['CODE'],
z = df['GDP (BILLIONS)'],
text = df['COUNTRY'],
marker = dict(line = dict(color = 'rgb(12,12,12)',width = 1.5))
)
layout = dict(
title = '2014 Global GDP',
geo = dict(
showframe = False,
showlakes=True, lakecolor='rgb(85,173,240)',
projection = {'type':'natural earth'}
)
)
choromap3 = go.Figure(data=[data], layout=layout)
iplot(choromap3)