Eind997
Eind997

Reputation: 467

Why does my Julia script not show plots in Pluto?

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?

Upvotes: 3

Views: 573

Answers (1)

BallpointBen
BallpointBen

Reputation: 13750

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.

Upvotes: 5

Related Questions