# Staircase (or step) plot using Plots.jl

**URL:** <https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933>\
**Category:** New to Julia\
**Tags:** plotting, plots\
**Created:** [March 16, 2019, 12:10am UTC](https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933 "2019-03-16T00:10:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [March 16, 2019, 12:10am UTC](https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933/1 "2019-03-16T00:10:47Z")

</div>

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](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](https://github.com/Evizero/UnicodePlots.jl)).

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [March 16, 2019, 12:18am UTC](https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933/2 "2019-03-16T00:18:39Z")

</div>

In Plots.jl just use:

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

```

or

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

```

You could also just use the PyPlot interface to Matplotlib.

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [March 16, 2019, 12:25am UTC](https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933/3 "2019-03-16T00:25:23Z")

</div>

Excellent! Thank you a million.

I do feel a little bit stupid that while searching the page [http://docs.juliaplots.org/latest/attributes/](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.

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [March 16, 2019, 12:31am UTC](https://discourse.julialang.org/t/staircase-or-step-plot-using-plots-jl/21933/4 "2019-03-16T00:31:40Z")

</div>

Glad that helped!
