# Plotting each of the equations in an ODE system in a different figure window

**URL:** <https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404>\
**Category:** Numerics\
**Tags:** plotting, ode\
**Created:** [December 8, 2022, 3:20am UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404 "2022-12-08T03:20:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jethro-djan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jethro-djan/32/44965_2.png) [@jethro-djan](https://discourse.julialang.org/u/jethro-djan)\
**Post date:** [December 8, 2022, 3:20am UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/1 "2022-12-08T03:20:43Z")

</div>

Hello everyone.

I have solved a system of fractional ODEs using a tool I found on [github](https://github.com/SciFracX/FractionalDiffEq.jl) and I want to plot it. The way I want to go about it is this: each solution in the system plotted against time and in different figure windows. The docs for the tool has uses something like this

```julia
plot(sol)

```

However this superimposes all the equations atop each other. In my case, I want them all separated. Or maybe the chance to plot each of them and save the output. Is this possible with Julia plot?

---

<div class="post-metadata">

**Author:** ![Andrew\_Swann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrew_swann/32/32106_2.png) [@Andrew\_Swann](https://discourse.julialang.org/u/Andrew_Swann)\
**Post date:** [December 8, 2022, 8:33am UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/2 "2022-12-08T08:33:41Z")

</div>

You should be able to pass a `layout` option to `plot` to do this. E.g. something like

```julia
plot(sol, layout=4)

```

if there are four functions. You should alse be able to write `layout=(2,2)` to get a two-by-two grid. The `plots` documentation gives more information about layouts.

---

<div class="post-metadata">

**Author:** ![jethro-djan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jethro-djan/32/44965_2.png) [@jethro-djan](https://discourse.julialang.org/u/jethro-djan)\
**Post date:** [December 8, 2022, 11:57am UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/3 "2022-12-08T11:57:28Z")

</div>

I am familiar with this option and this has been my goto for now. However, for example, if I have 4 functions I need 4 different figures each in its own window that I can save separately. I need a way to isolate a function from the `sol` matrix if you get my drift and plot it.

---

<div class="post-metadata">

**Author:** ![Andrew\_Swann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrew_swann/32/32106_2.png) [@Andrew\_Swann](https://discourse.julialang.org/u/Andrew_Swann)\
**Post date:** [December 8, 2022, 12:44pm UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/4 "2022-12-08T12:44:24Z")

</div>

I see. Yes the `layout` option produces one “plot” with several subplots. The other suggestion would then be to try to specify `vars`. Looking at the source code of the package you are using the plot recipes are in

> <https://github.com/SciFracX/FractionalDiffEq.jl/blob/master/src/utils.jl>

Each recipe has a `vars` option. If it is not specified then it produces one series for each function, which without layout makes one plot, and with layout gets split out in to different subplots. However, with `vars` the behaviour is different. So I would try

```julia
plot(sol,vars=(0,3))

```

to plot the third function against time (the code seems single `0` out for the time).

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [December 8, 2022, 4:30pm UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/5 "2022-12-08T16:30:50Z")

</div>

Here are some work-arounds I use depending on the situation:

- Screen capture. Paste in paint (ms windows) for side-by-side comparison to a newer figure–quick and dirty.
- Store result of plot in a variable, say `p1`, plot it again later with `display(p1)`, But you still can’t see multiple simultaneously.
- Save to an image file [Tutorial · Plots](https://docs.juliaplots.org/stable/tutorial/#Saving-Figures). Open image files simultaneously externally from Julia for comparisons. This works for generating several plots programmatically, say in a loop.

I’m still using an older version of Plots. Maybe `overwrite_figure` works in for GR a newer version.

---

<div class="post-metadata">

**Author:** ![jethro-djan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jethro-djan/32/44965_2.png) [@jethro-djan](https://discourse.julialang.org/u/jethro-djan)\
**Post date:** [December 8, 2022, 5:13pm UTC](https://discourse.julialang.org/t/plotting-each-of-the-equations-in-an-ode-system-in-a-different-figure-window/91404/6 "2022-12-08T17:13:00Z")

</div>

Thank you. This does what I need
