Hello! I am trying to create a few rows of subplots, each row containing the same number of subplots as well as a title. I have done this with nested plots of lists.
using Plots
plotly()
x = 0:0.01:10
n = 3
m = 5
plots = []
for i in 1:m
ps = []
for j in 1:n
y = sin.(j*i*x/2pi)
p = plot(x, y)
push!(ps, p)
end
pp = plot(ps..., layout=(1, n), plot_title="Row number $(i)")
push!(plots, pp)
end
plot(plots..., layout=(m,1), legend=false)
This works well, except for one thing. The row titles should number up, each saying Row number $(i)
. However, the top title does not say Row number 1
, but rather is the same as the bottom title (in the above case, it says Row number 5
. One can plot the elements of plots
individually, and the first element will indeed have the title Row number 1
. I do not understand why this happens, and I do not know how to fix it. Any help is appreciated.