# Which size for subplots (Plots.jl/GR)

**URL:** <https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936>\
**Category:** General Usage\
**Tags:** plots, gr\
**Created:** [January 25, 2021, 9:29pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936 "2021-01-25T21:29:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [January 25, 2021, 9:29pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/1 "2021-01-25T21:29:16Z")

</div>

I have 12 plots of size (400px,400px).  
Each one individually looks fine. But when composing them into a grid(1,12), they start to overlap and  
the y-labels and ticks have too much distance for the y-axis.

I know that I can fix the overlap by defining a margin. But I don’t know how to move the y-labels and ticks closer to the y-axis? Is there some trick?

```julia
function make_plot(N,M)
    plotsize = (400,400)
    plts = [plot(1:10, ylabel="Some Text", plotsize=plotsize) for i in 1:N*M]
    plot(plts..., layout=grid(N,M), size=plotsize .* (M,N))
end

make_plot(1,1)
#savefig("demo1.png")
make_plot(1,6)
#savefig("demo6.png")
make_plot(1,12)
#savefig("demo12.png")

```

![demo1](https://global.discourse-cdn.com/julialang/original/3X/0/6/060c2b889e77af8625d75a80f2fc69709962cbe6.png)

 ![demo6](https://global.discourse-cdn.com/julialang/original/3X/4/8/486e332c8f8db2dd54da92c1d17261ca05681308.png) ![demo12](https://global.discourse-cdn.com/julialang/original/3X/4/c/4cee60bcfe01c93aee8be5258784273d9e0c334d.png)

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [March 25, 2021, 2:21pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/2 "2021-03-25T14:21:27Z")

</div>

I don’t know if it’s ok to bump up questions.

But I am again stuck at this 😕 (should I post it as an issue Plots.jl?)

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [March 25, 2021, 2:52pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/3 "2021-03-25T14:52:11Z")

</div>

> [@SteffenPL](#):
>
> But I am again stuck at this 😕 (should I post it as an issue Plots.jl?)

The distance between the labels and the axis is something that certainly deserves to be reported.

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [March 25, 2021, 3:12pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/4 "2021-03-25T15:12:19Z")

</div>

Thanks! I submitted an issue: [[BUG] axis labels overlap with plots in large subplots · Issue #3378 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/3378)

---

<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:** [March 25, 2021, 8:58pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/5 "2021-03-25T20:58:59Z")

</div>

Using the `plotly()` backend and the margin attribute, decent results are obtained:

```julia
using Plots; plotly()
using Plots.Measures

function make_plot(N,M)
    plotsize = (M*400,N*400)
    plts = [plot(rand(10), xlabel="X-axis ($i)", ylabel="Y-axis ($i)", color=i,
         left_margin = 15mm, legend=false, plotsize=(400,400)) for i in 1:N*M]
    plot(plts..., layout=(N,M), size=plotsize)
end

make_plot(1,12)

```

_PS: there are 12 subplots but truncated here for better visualization (cursor shows reading on curve):_

 ![plotly_1x12_with_15mm_left_margin](https://global.discourse-cdn.com/julialang/original/3X/7/2/72e1267aa80fd9a367904965169aa0c810da0aa6.jpeg)

---

<div class="post-metadata">

**Author:** ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Post date:** [March 27, 2021, 1:40pm UTC](https://discourse.julialang.org/t/which-size-for-subplots-plots-jl-gr/53936/6 "2021-03-27T13:40:42Z")

</div>

Yes, plotly works! Thanks for the hint.
