Splatting an array of plots

I’m trying to construct an array of plots and then plot them all on a grid. I initialize the array like this:

plots = Array{Plots.Plot{Plots.GRBackend}}(undef,10)

and populate the array inside a loop like this:

plots[i] = myplot

Then I try to splat out the plots inside the plot command:

plot(plots...,layout = (3,3))

but I get an undefinedReference error. But I can do:

plot(plots[1],plots[2],plots[3]...,layout = (3,3))

which is not great if you have a lot of plots.

I assume you generate 9 plots and save it in an array of length 10.
Probably the undefined value in the array makes problems.

Feeling stupid… I initialized the array to have 10 elements and then only populated the first 9.