步骤 drawstyle plotly dash

Step drawstyle plotly dash

我使用 matplotlib 创建了一些很酷的图表,x 上的“drawstyle steps”时间,y 上的分类数据以及这些点之间的步骤如下图所示。这在情节上可能吗?我只找到了 gannt,但这不是我需要的,在一种瀑布图中会很好,但我在时间轴 (x) 上有多个相同的类别,不能完全相同,但我可以看到多长时间从一个数据点到另一个数据点的时间(在我的例子中是 timedelta)

您可以像这样使用 line_shape(设置为 vhhv)和 line_dash

import plotly.express as px

fig = px.line(x=[0,1,2,3,4,5], y=[0,1,0,2,0,1])
fig.update_traces(mode="markers+lines", line_shape="vh", line_dash="dash")
fig.show()