【问题标题】:Plotly 3D scatter plot has very small window size in Google ColabPlotly 3D 散点图在 Google Colab 中的窗口大小非常小
【发布时间】:2020-06-11 10:57:30
【问题描述】:

我有this .ipynb file。在我的桌面上打开它 Colab 时,它工作正常

如果我在 Chrome 中测试模拟 Galaxy S5,结果也很好

然而,我在一个真正的手机上测试它,图表的尺寸如此之小,以至于无法看到任何有价值的东西......

如何让真实手机中的结果占用更多空间?

【问题讨论】:

    标签: python python-3.x jupyter-notebook google-colaboratory plotly-python


    【解决方案1】:

    你需要在图上调用update_layout方法来更新布局。

    fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
    

    只需添加这一行,图像就会更新为这个。

    您还可以更新其他属性,例如图例位置及其方向。

    fig.update_layout(legend=dict(x=.2, y=-1.2),margin=dict(l=0, r=0, b=0, t=0))
    

    这看起来不错,虽然 3d 图像的大小已减小。

    如果我们使用图例方向作为水平,那么图像是相当好的。

    fig.update_layout(legend_orientation="h",margin=dict(l=0, r=0, b=0, t=0))
    

    要找到布局的确切值没有正确的方法,您需要使用参数来获得近似结果。

    【讨论】:

    • 谢谢。已达到每日投票上限,将在接下来的几天内投票。另外,不知道为什么,但现在无法授予赏金。一旦我可以做到。
    猜你喜欢
    • 2018-10-27
    • 2016-08-21
    • 1970-01-01
    • 2019-03-05
    • 2019-06-20
    • 2018-06-24
    • 1970-01-01
    • 2021-04-17
    • 1970-01-01
    相关资源
    最近更新 更多