# Plots with many sub-plots

**URL:** https://discourse.julialang.org/t/plots-with-many-sub-plots/62440
**Category:** New to Julia
**Created:** [June 5, 2021, 2:44pm UTC](https://discourse.julialang.org/t/plots-with-many-sub-plots/62440 "2021-06-05T14:44:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)
#### Post date: [June 5, 2021, 2:44pm UTC](https://discourse.julialang.org/t/plots-with-many-sub-plots/62440/1 "2021-06-05T14:44:16Z")

</div>

I’m struggling to fit a lot of subplots into one plot.

When I have few plots, it looks fine with nicely separated sub-plots:

```julia

gr(;size = (300,200), thickness_scaling = .5)
plot([plot(curveset[x]) for x in 1:6]..., layout = (2,3),link= :all)

```

![billede](https://global.discourse-cdn.com/julialang/original/3X/a/3/a320e79f4ec21ffbcdc6dc815657eb8fc7da5868.png)

But when I stuff 16x24 plots together, the axes labels move away and overlap with the adjacent sub-plot:

```julia
gr(;size = (2400,1600), thickness_scaling = .5)
plot([plot(curveset[x]) for x in 1:384]..., layout = (16,24),link= :all)

```

![billede](https://global.discourse-cdn.com/julialang/original/3X/9/8/989db2ee15a6f1fd9d1b9e42c7073b008388efaa.png)

It is probably just some option, I’m missing, but I’m not able to find it.  
Help will be much appreciated.

Here’s how to generate the example plots:

```julia
using Printf, Distributions, Plots

struct Curve
    title::String
    t::Vector{Float64}
    y::Vector{Float64}
end

wells = [@sprintf("%s%.2d", a,i) for a in 'A':'P' for i in 1:24];

curveset = [Curve(tit, 0:9, 3 .*(1 .- exp.(-(0:9) ./2)) .+ rand(Normal(0, .1),10)) for tit in wells];

@recipe function f(c::Curve)
    title := c.title
    label := ""
    @series begin
        seriestype := :scatter
        c.t, c.y
    end
    @series begin
        seriestype := :line
        c.t, c.y
    end
end

gr(;size = (2400,1600), thickness_scaling = .5)
plot([plot(curveset[x]) for x in 1:384]..., layout = (16,24),link= :all)

```

---

<div class="post-metadata">

### Author: ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)
#### Post date: [June 5, 2021, 5:27pm UTC](https://discourse.julialang.org/t/plots-with-many-sub-plots/62440/2 "2021-06-05T17:27:52Z")

</div>

I‘ve also noticed that issue: [StatsPlots appearance · Issue #281 · TuringLang/MCMCChains.jl · GitHub](https://github.com/TuringLang/MCMCChains.jl/issues/281)

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [June 5, 2021, 5:43pm UTC](https://discourse.julialang.org/t/plots-with-many-sub-plots/62440/3 "2021-06-05T17:43:50Z")

</div>

Did you try Plots.jl’s plotly backend?  
See one example [here](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/5).

---

<div class="post-metadata">

### Author: ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)
#### Post date: [June 5, 2021, 7:47pm UTC](https://discourse.julialang.org/t/plots-with-many-sub-plots/62440/4 "2021-06-05T19:47:37Z")

</div>

Thank you @rafael.guerra .

Plotly does it well:

```julia
plotly(;size = (2400,1600), thickness_scaling = .5)
plot([plot(curveset[x]) for x in 1:384]..., layout = (16,24),link= :all)

```

![image](https://global.discourse-cdn.com/julialang/original/3X/3/d/3d0d9b7afd97a8244432cb7d77f8ad636243c749.png)
