我尝试了文档中的许多大小调整参数:plotly documentation,但在Jupyter下没有任何参数与我的浏览器协作。
我有一个代码:
layout = dict(
title = 'city populations<br>(Click legend to toggle traces)',
showlegend = True,
geo = dict(
scope='europe',
resolution = 50,
projection=dict( type='mercator' ),
showland = True,
landcolor = "rgb(217, 217, 217)",
subunitcolor="rgb(255, 255, 255)",
countrycolor="rgb(255, 255, 255)",
lonaxis = dict( range= [ 14.0, 24.0 ] ),
lataxis = dict( range= [ 49.0, 55.0 ] ),
autosize=False,
width=1000, height=1000,
margin=dict( l=50, r=50, b=50, t=50, pad=4, autoexpand=True ),
showrivers = True
)
)
并想以某种方式设置更大的mapbox大小,但它总是相同的(大约30%的屏幕宽度)。浏览器中有很大的空间。为什么不能调整此窗口的大小?它总是在350x350像素左右。
执行代码:
fig = dict( data=cities, layout=layout )
py.iplot( fig, validate=False, update=True, resize=True )
请给我一些提示,因为这是我使用这个奇妙工具的第一天。
编辑:现在可以使用了:
layout = dict(
title = '2015 Poland city populations<br>(Click legend to toggle traces)',
showlegend = True,
autosize=False,
width=1000, height=1000,
margin=dict( l=50, r=50, b=50, t=50, pad=4, autoexpand=True ),
geo = dict(
scope='europe',
resolution = 50,
projection=dict( type='mercator' ),
showland = True,
landcolor = "rgb(217, 217, 217)",
subunitcolor="rgb(255, 255, 255)",
countrycolor="rgb(255, 255, 255)",
lonaxis = dict( range= [ 14.0, 24.0 ] ),
lataxis = dict( range= [ 49.0, 55.0 ] ),
showrivers = True
)
)
发布于 2017-03-20 18:38:10
width
和height
必须是layout
字典中的键值对,而不是geo
字典中的键值对(与autosize
和margin相同)。
尝试删除validate=False
以从Plotly获取有关这些键的警告消息。
https://stackoverflow.com/questions/42893446
复制相似问题