I am trying to plot some data within one loop using the following code:
n=length(B)
for i in 1:n
i=contourf(x,y,B[i], layout=n)
display(i)
end
Here B is a matrix and each B[i] is one array. When using the above code, it only output one image and some others are overlapped, as shown below. I am wondering how could I plot all the images as a function of i. Thanks
julia> ps = map(1:4) do s
x = rand(100)
y = s * x .+ rand(100)
scatter(x, y, ylim = [0, 5])
end
4-element Vector{Plots.Plot{Plots.GRBackend}}:
Plot{Plots.GRBackend() n=1}
Plot{Plots.GRBackend() n=1}
Plot{Plots.GRBackend() n=1}
Plot{Plots.GRBackend() n=1}
julia> plot(ps...)
julia> using Plots
julia> plt = plot(layout=(2,3)) # create plot object with the desired layout
julia> for i in 1:6
plot!(plt, rand(10), subplot=i) # plot each set in a different subplot
end
julia> display(plt)