正如你在这里看到的https://www.kaggle.com/asindico/exploratory-analysis我试图通过绘图来绘制世界地图,但地图未显示。任何建议将不胜感激
这是相关的代码块
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笔记本
答案 0 :(得分:0)
您是否添加了该行:
init_notebook_mode(connected = True)
您需要此行在jupyter笔记本中显示图形。