3

This is the code I'm trying to run

begin
    for i in 1:10:100
        display(Plots.plot(x[i:i+100]))
    end
end

and this is the output I get

Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}Plot{Plots.GRBackend() n=1}

I'm trying to get a series of different figures that show the different slices of x that are specified in each loop. Does anyone know how I can achieve this?

Eind997
  • 319
  • 1
  • 3
  • 9
  • Could you clarify what you want the output to look like? What do you mean by "a series of different figures" - are you looking for an animation, or a plot with multiple subplots, or just multiple plots in a row (somewhat like the answer from BallPointPen)? – Nils Gudat Oct 31 '22 at 13:28
  • @NilsGudat I'm expecting something like what you get with Matplotlib if you plot graphs on different figures: the two will be completely separate. Like using Figure() in Matlab. – Eind997 Oct 31 '22 at 18:26

1 Answers1

5

If, say, you wanted the graphs in a 5-by-2 grid, you could do the following:

[collect(row) for row in eachrow(reshape([Plots.plot(i:i+100) for i in 1:10:100], (5,:)))]

(I've removed x to avoid an undefined variable error.)

Pluto graph output

It's not ideal, so hopefully someone comes along with a better solution.

BallpointBen
  • 9,406
  • 1
  • 32
  • 62