Home > other >  Name of this 'horizontal section' diagram and how to implement in PyPlot
Name of this 'horizontal section' diagram and how to implement in PyPlot

Time:11-02

I need to create a plot with matplotlib/pyplot in a very specific way. I want the curve to never go up again, instead I want these horizontal sections with the little overstanding line, like shown in the picture:

Text

Source: My approach

CodePudding user response:

The example you cited from scikit-learn uses drawstyle='steps-post' (this demo illustrates what it does), so try

plt.plot(x, y, drawstyle='steps-post')
  • Related