Which size for subplots (Plots.jl/GR)

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?

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

2 Likes

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

But I am again stuck at this :confused: (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.

1 Like

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

1 Like

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

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):

Yes, plotly works! Thanks for the hint.