# Working with the recent stepplot() changes in ControlSystems.jl

**URL:** https://discourse.julialang.org/t/working-with-the-recent-stepplot-changes-in-controlsystems-jl/74131
**Category:** General Usage
**Tags:** question, package, plotting, controlsystems
**Created:** [January 6, 2022, 11:28am UTC](https://discourse.julialang.org/t/working-with-the-recent-stepplot-changes-in-controlsystems-jl/74131 "2022-01-06T11:28:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adeyemiadeoye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeyemiadeoye/32/32475_2.png) [@adeyemiadeoye](https://discourse.julialang.org/u/adeyemiadeoye)
#### Post date: [January 6, 2022, 11:28am UTC](https://discourse.julialang.org/t/working-with-the-recent-stepplot-changes-in-controlsystems-jl/74131/1 "2022-01-06T11:28:34Z")

</div>

I am trying to run the example usage code provided in the `README.md` file of the [ControlSystems.jl](https://github.com/JuliaControl/ControlSystems.jl) repository, but with the recent changes, it seems impossible to produce exactly the same `stepplot()` results with `plot(step())` as the recent changes note suggests.

As another specific use example, how would one use the new replacement for `stepplot()` in the following?

```julia
using ControlSystems 
using Plots
pyplot()

M = 7
K = 2.8
fv = [1.5 5 20]
wn = sqrt(K/M)
zetas = fv ./ (M * 2 * wn) 
G = [tf([wn^2], [1, 2*zeta*wn, wn^2]) for zeta in zetas ]
t = 0:0.01:40

stepplot(G, t, lw=3, label=[L"F_v="*"$(fv[1])" L"F_v="*"$(fv[2])" L"F_v="*"$(fv[3])"])

```

Thanks.

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [January 6, 2022, 2:48pm UTC](https://discourse.julialang.org/t/working-with-the-recent-stepplot-changes-in-controlsystems-jl/74131/2 "2022-01-06T14:48:03Z")

</div>

Hey and welcome to the community! Thanks for pointing out the problem in the readme, I’ll fix it.

There are no plot recipes for vectors of `SimResult` at the moment, but such recipes should perhaps be added.  
Your example would currently look like this

```julia
M = 7
K = 2.8
fv = [1.5, 5, 20]
wn = sqrt(K/M)
zetas = fv ./ (M * 2 * wn) 
G = [tf([wn^2], [1, 2*zeta*wn, wn^2]) for zeta in zetas ]
t = 0:0.01:40

plot()
for (G, lab) in zip(G, ["F_v="*"$(fv[1])" "F_v="*"$(fv[2])" "F_v="*"$(fv[3])"])
    plot!(step(G, t); lw=3, lab)
end
display(current())

```

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [January 6, 2022, 2:56pm UTC](https://discourse.julialang.org/t/working-with-the-recent-stepplot-changes-in-controlsystems-jl/74131/3 "2022-01-06T14:56:08Z")

</div>

[https://github.com/JuliaControl/ControlSystems.jl/pull/594](https://github.com/JuliaControl/ControlSystems.jl/pull/594)  
you’ll soon be able to plot a vector of `SimResult` rather than writing a loop, then your example will be

```julia
plot(step.(G, Ref(t)); lw=3, label=["F_v="*"$(fv[1])" "F_v="*"$(fv[2])" "F_v="*"$(fv[3])"])

```
