【发布时间】:2017-11-19 22:16:54
【问题描述】:
正如您在此处看到的https://www.kaggle.com/asindico/exploratory-analysis 我正在尝试通过 plotly 绘制世界地图,但未显示地图。任何建议将不胜感激
这是相关的代码块
w_data = [ dict(
type = 'choropleth',
locations = data['Country'].value_counts().index,
z = data['Country'].value_counts(),
locationmode = 'country names',
text = data['Country'].value_counts().index,
marker = dict(
line = dict(color = 'rgb(0,0,0)', width = 1)),
colorbar = dict(tickprefix = '',
title = 'World map')
)
]
layout = dict(
title = 'World map',
width = 20,
height = 15,
geo = dict(
showframe = False,
showocean = True,
oceancolor = 'rgb(0,255,255)',
projection = dict(
type = 'orthographic',
rotation = dict(
lon = 60,
lat = 10),
),
lonaxis = dict(
showgrid = True,
gridcolor = 'rgb(102, 102, 102)'
),
lataxis = dict(
showgrid = True,
gridcolor = 'rgb(102, 102, 102)'
)
),
)
fig = dict(data=w_data, layout=layout)
py.iplot(fig, validate=False)
它属于 Jupyter 笔记本
【问题讨论】:
标签: python pandas jupyter-notebook plotly