Plot layout with parametrized number of rows/columns

As far as I can see, the problem is not in the layout. What you have to do is this:

  • p = [] instead of p = empty()
  • push!(p, plot(x, sin.(x))) instead of append!(p, plot(x, sin.(x)))

After these changes the code worked correctly and produced the following picture
image
Also the ‘standard’ way to define ranges is 1:Nplots, not range(1, Nplots).

Hope my answer was helpful