Specific layout for @layout macro in Plots.jl

I’m trying to generate a rather specific custom layout with the @layout macro. I’ve checked the documentation (http://docs.juliaplots.org/latest/layouts/#advanced-layouts), but it’s rather sparse and doesn’t quite give me everything I need to make this work.

Here’s a mockup of what I’m aiming for:
plot_want

Currently I’m using the following code, but it seems very far off, and is mostly inspired from this thread https://discourse.julialang.org/t/plots-jl-layout-macro-usage/11024

l2 = @layout [ a{0.8w,0.2h} _; b{0.8w,0.2h}  c{0.2h,0.2w} _; d{0.8w,0.8h} e{0.8h,0.2w} f{0.8h,0.2w} ]
pp = plot(showaxis=false, ticks=false)
...
all_plots = plot(p1,p2,p3,p4,p5,p6,pp,pp,layout=l2)

Any help would be greatly appreciated! :slight_smile:

If nobody comes up with a Plots solution, maybe I can at least help you out with a Makie version:

using CairoMakie

f = Figure()
lines(f[1, 1], cumsum(randn(100)))
heatmap(f[2, 1], randn(30, 10))
heatmap(f[3, 1], randn(50, 50))
lines(f[1:2, 2:3], cumsum(randn(100)))
lines!(cumsum(randn(100)))
heatmap(f[3, 2], randn(10, 30))
lines(f[3, 3], cumsum(randn(50)))
rowsize!(f.layout, 3, Relative(0.7))
colsize!(f.layout, 1, Relative(0.6))
f

3 Likes

Thank you very much Jules, this produces exactly the output I want. However, I really do need to solve this problem using Plots.jl :frowning: . I’ve spent hours trying to get the Makie packages to work on my machine, but to no avail.

I do think some Makie users will benefit from your excellent answer though, so thank you anyway! :slight_smile:

No problem, sorry to hear that it doesn’t work on your machine. If you have time, issues are always appreciated although I haven’t heard about problems with CairoMakie in a while

A Plots.jl solution.

using Plots
default(legend = false, tickfontsize=6)

A = plot(cumsum(randn(100)))
B = heatmap(randn(30, 10))
C = heatmap(randn(50, 50))
D = plot([cumsum(randn(100)) cumsum(randn(100))])
E = heatmap(randn(10, 30))
F = plot(cumsum(randn(50)))

layout = @layout [
    [a; b] d{0.4w, 0.4h}
    c      [e f]
]
plot(A, B, D, C, E, F; layout)

3 Likes

Fantastic, thank you so much genkuroki!