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:

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')

