# How to plot an array of plots?

**URL:** <https://discourse.julialang.org/t/how-to-plot-an-array-of-plots/51078>\
**Category:** New to Julia\
**Tags:** plotting\
**Created:** [December 2, 2020, 2:24am UTC](https://discourse.julialang.org/t/how-to-plot-an-array-of-plots/51078 "2020-12-02T02:24:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew-saydjari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrew-saydjari/32/19896_2.png) [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Post date:** [December 2, 2020, 2:24am UTC](https://discourse.julialang.org/t/how-to-plot-an-array-of-plots/51078/1 "2020-12-02T02:24:36Z")

</div>

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

```julia
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.

```julia
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?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 2, 2020, 2:32am UTC](https://discourse.julialang.org/t/how-to-plot-an-array-of-plots/51078/2 "2020-12-02T02:32:46Z")

</div>

> [@andrew-saydjari](#):
>
> plot(Array[p1 p2 p3 p4])

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

This is called splatting, basically:

```julia
f(1,2,3) == f([1,2,3]...)

```

---

<div class="post-metadata">

**Author:** ![andrew-saydjari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrew-saydjari/32/19896_2.png) [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Post date:** [December 2, 2020, 2:33am UTC](https://discourse.julialang.org/t/how-to-plot-an-array-of-plots/51078/3 "2020-12-02T02:33:51Z")

</div>

Wow. Thank you so much!
