情节:轴“痕迹”没有效果

发布于 2025-02-04 04:07:55 字数 740 浏览 1 评论 0原文

我一直在尝试将轴绘制在迹线上。这似乎是默认行为(根据 documentation ),并由layout.xaxis.layer控制。但是,无论该属性的价值如何,似乎轴都保持在轨迹之下。

最小示例:

import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(x=[-1,2,3], y=[-3,4,5], mode='lines'))
fig.update_xaxes(layer="above traces")
fig.update_yaxes(layer="above traces")
fig.show()

结果: 示例绘图

plotly版本:5.8.0

编辑:如果我使用plotly plotly,也会发生同样的情况。 .express.line用于图,随后使用update_xaxes强制属性分配。

I have been trying to plot axes above traces. This appears to be the default behavior (according to the documentation), and to be controlled by layout.xaxis.layer. Though, no matter the value of this property, it seems that the axes stay below the traces.

Minimal example:

import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(x=[-1,2,3], y=[-3,4,5], mode='lines'))
fig.update_xaxes(layer="above traces")
fig.update_yaxes(layer="above traces")
fig.show()

Result:
Example Plot

Plotly version: 5.8.0

Edit: The same happens if I use plotly.express.line for the plot and subsequently force the property assignment with update_xaxes.

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

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

发布评论

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