Python 未显示的绘图地图
正如你在这里看到的,我试图通过plotly绘制世界地图,但地图没有显示。如有任何建议,将不胜感激 下面是相关的代码块Python 未显示的绘图地图,python,pandas,jupyter-notebook,plotly,Python,Pandas,Jupyter Notebook,Plotly,正如你在这里看到的,我试图通过plotly绘制世界地图,但地图没有显示。如有任何建议,将不胜感激 下面是相关的代码块 w_data = [ dict( type = 'choropleth', locations = data['Country'].value_counts().index, z = data['Country'].value_counts(), locationmode = 'country names',
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笔记本电脑您是否添加了以下行:
init_notebook_mode(connected = True)
您需要这一行在jupyter笔记本中显示图形