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

Hello everyone.

I have solved a system of fractional ODEs using a tool I found on github 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

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?

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

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.

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.

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

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

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

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

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

Thank you. This does what I need