什么是减少仪表板和模式栏之间的空间的正确方法?

发布于 2025-01-27 23:04:01 字数 1182 浏览 2 评论 0原文

我正在尝试实时绘制一些数据,并且由于数字尺寸,侧边栏被推到正确的位置。控制差距的正确方法是什么?

我的代码:

app = dash.Dash(__name__)
app.layout = html.Div(
    [
        dash.dcc.Graph(id='live-graph'),
        dash.dcc.Interval(id='time', interval=250),
    ],
        style={"display": "inline-block"}
)

@app.callback(Output('live-graph', 'figure'),
          [
              Input('time', 'n_intervals')
    ]
)
def update(t):
    if t is None:
        return dash.no_update
    
    fig = go.Figure(data={'data':
                  [
                      go.Scatter3d(...),
                      go.Scatter3d(...)
            ]
        }
    )
    fig.update_layout(uirevision='constant',
                      scene_camera=camera,
                      width=2000,
                      height=2000,
                      margin=dict(l=20, r=0, t=20, b=20, pad=0),
                      scene=dict(xaxis=dict(range=[-10, 10]), yaxis=dict(range=[-10, 10]), zaxis=dict(range=[0, 3])))
    return fig

I'm trying to live plot some data and the sidebar is getting pushed to the right too much because of the figure dimensions. What's the proper way to control that gap?
enter image description here

My code:

app = dash.Dash(__name__)
app.layout = html.Div(
    [
        dash.dcc.Graph(id='live-graph'),
        dash.dcc.Interval(id='time', interval=250),
    ],
        style={"display": "inline-block"}
)

@app.callback(Output('live-graph', 'figure'),
          [
              Input('time', 'n_intervals')
    ]
)
def update(t):
    if t is None:
        return dash.no_update
    
    fig = go.Figure(data={'data':
                  [
                      go.Scatter3d(...),
                      go.Scatter3d(...)
            ]
        }
    )
    fig.update_layout(uirevision='constant',
                      scene_camera=camera,
                      width=2000,
                      height=2000,
                      margin=dict(l=20, r=0, t=20, b=20, pad=0),
                      scene=dict(xaxis=dict(range=[-10, 10]), yaxis=dict(range=[-10, 10]), zaxis=dict(range=[0, 3])))
    return fig

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文