步骤drawstyle破折号

时间:2020-01-31 19:58:38

标签: python matplotlib plotly hyphen

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

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以像这样使用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()

enter image description here