Staircase (or step) plot using Plots.jl

plotting
#1

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

#2

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.

1 Like
#3

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.

#4

Glad that helped!

1 Like