首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何使用plotly调整贴图的宽度(python)

如何使用plotly调整贴图的宽度(python)
EN

Stack Overflow用户
提问于 2017-03-20 07:07:50
回答 1查看 1.5K关注 0票数 1

我尝试了文档中的许多大小调整参数: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
        )
    )
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-20 18:38:10

widthheight必须是layout字典中的键值对,而不是geo字典中的键值对(与autosize和margin相同)。

尝试删除validate=False以从Plotly获取有关这些键的警告消息。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42893446

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档