Staircase (or step) plot using Plots.jl

How can I produce a staircase (some may call it step) plot for a given array? Something along the line of step function in Matplotlib (https://matplotlib.org/api/_as_gen/matplotlib.pyplot.step.html). The only solution I can found is the stairs function provided by the Unicodeplot package (https://github.com/Evizero/UnicodePlots.jl).

1 Like

In Plots.jl just use:

using Plots
plot(1:100, 1:100, linetype=:steppre)

or

plot(1:100, 1:100, linetype=:steppost)

You could also just use the PyPlot interface to Matplotlib.

6 Likes

Excellent! Thank you a million.

I do feel a little bit stupid that while searching the page http://docs.juliaplots.org/latest/attributes/ back and forth it did not occur to me that something called steppre was what I had been looking for.

1 Like

Glad that helped!

1 Like