堆栈绘图表达线图ATOP graph_objects填充散点图
我想堆叠plotly.express
line绘图在graph_objects
的填充矩形上。用px.line
创建图形,然后添加填充的矩形使矩形显示在行上方(笔记本)。
import plotly.express as px
import plotly.graph_objects as go
fig = px.line(x=[0, 2, 4], y=[1, 2, 3])
fig.add_trace(go.Scatter(
x=[1, 1, 3, 3, 1],
y=[0, 5, 5, 0, 0],
fill="toself")
)
fig.show()
如何在矩形上方获得线路?
I'd like to stack a plotly.express
line plot atop a filled rectangle from graph_objects
. Creating the figure with px.line
and then adding the filled rectangle makes the rectangle show up above the line (notebook).
import plotly.express as px
import plotly.graph_objects as go
fig = px.line(x=[0, 2, 4], y=[1, 2, 3])
fig.add_trace(go.Scatter(
x=[1, 1, 3, 3, 1],
y=[0, 5, 5, 0, 0],
fill="toself")
)
fig.show()
How can I get the line above the rectangle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应用答案 to 在plotly.express中添加痕迹:
Applying the answer to How to add traces in plotly.express :