How to plot an array of plots?

I am trying to just plot a bunch of heatmaps in a script, but am not seeing the expected performance.

p1 = Plots.heatmap(rand(256,256))
p2 = Plots.heatmap(rand(256,256))
p3 = Plots.heatmap(rand(256,256))
p4 = Plots.heatmap(rand(256,256))

plot(p1,p2,p3,p4)

This works. However, the below does not. Am I making some obvious mistake?

plot(Array[p1 p2 p3 p4])

This returns a Method Error on converting the object type.

This was my attempt at doing the simpler version of what I really want to do.

plot_array = Any[ ]
for i in 1:8
    push!(plot_array,
    plot(Plots.heatmap(rand(256,256),
        xlims=(1,256),
        ylims=(1,256),
        aspectratio=1,
        #axis=nothing,
        #border=:none,
        c=:cubehelix)))
end

plot(plot_array)

Where I also hit a MethodError complaining about the Plots.Plot being ::Char instead of ::Any?

2 Likes

plot([p1,p2,p3,p4]...)

This is called splatting, basically:

f(1,2,3) == f([1,2,3]...)
3 Likes

Wow. Thank you so much!