Plots with many sub-plots

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:


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

billede

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

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

billede

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:

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)

1 Like

I‘ve also noticed that issue: StatsPlots appearance · Issue #281 · TuringLang/MCMCChains.jl · GitHub

1 Like

Did you try Plots.jl’s plotly backend?
See one example here.

1 Like

Thank you @rafael.guerra .

Plotly does it well:

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

image

1 Like