【问题标题】:Set the spacing between axis label and axis ticks of a 3D surface plot created using Plotly设置使用 Plotly 创建的 3D 曲面图的轴标签和轴刻度之间的间距
【发布时间】:2023-02-05 07:10:15
【问题描述】:

如何在 python 中调整使用 Plotly 创建的 3D 曲面图的轴标签和轴刻度之间的间距?

【问题讨论】:

    标签: python plotly


    【解决方案1】:

    碰巧我想为我的图表做同样的事情。因此,要调整标签之间的间距并更改刻度位置和标签,我们可以使用 fig.update_layout() 方法将这些配置作为字典推送到图形的布局。

    例子

    fig = go.Figure(go.Surface(   
    x = X, # 1D array
    y = Y, # 1D array
    z = Z, # 2D array
    fig.update_layout(scene = dict(
                              xaxis = dict(
                                      ticktext= ['A','B','C'],
                                      tickvals= [0, 1, 2]
                              )
                     ))
    fig.show()
    

    笔记:请务必将此配置传递给场景属性。

    文档链接:https://plotly.com/python/3d-axes/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-04
      • 2017-11-25
      • 1970-01-01
      • 2016-02-18
      相关资源
      最近更新 更多