情节:轴“痕迹”没有效果
我一直在尝试将轴绘制在迹线上。这似乎是默认行为(根据 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论