我从文档中尝试了许多这些大小调整参数: plotly文档,但没有什么想在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 ) )并希望以某种方式设置更大的地图框大小,但它总是相同的(大约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 ) )I tried many of these sizing parameters from documentation: plotly documentation but nothing wants to cooperate with my browser under Jupyter.
I have a code:
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 ) )and want to somehow set larger mapbox size but it's always the same (of about 30% of screen width). There's plenty of room in the browser. Why couldn't resize this window? It's all the time about 350x350 pixels.
Executive code:
fig = dict( data=cities, layout=layout ) py.iplot( fig, validate=False, update=True, resize=True )Please give me some hint, because it's my first day with this wonderful tool.
EDIT: Now this works:
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 ) )最满意答案
width和height必须是layout字典中的键值对,而不是geo字典中的键值对(与autosize和边距相同)。
尝试删除validate=False以从Plotly获取有关这些键的警告消息。
width and height must be key-value pairs in the layout dictionary, not in the geo dictionary (same as autosize and margin).
Try removing validate=False to get the warning messages from Plotly about those keys.
更多推荐
发布评论