# Specific layout for @layout macro in Plots.jl

**URL:** <https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228>\
**Category:** General Usage\
**Tags:** question, plotting, plots, layout-plots\
**Created:** [July 7, 2021, 5:43pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228 "2021-07-07T17:43:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nick_k/32/26912_2.png) [@Nick\_k](https://discourse.julialang.org/u/Nick_k)\
**Post date:** [July 7, 2021, 5:43pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/1 "2021-07-07T17:43:09Z")

</div>

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](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](https://global.discourse-cdn.com/julialang/original/3X/9/d/9d74dfb6c32b0c7404ab1b8437a93322ec53aeba.png)

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](https://discourse.julialang.org/t/plots-jl-layout-macro-usage/11024)

```julia
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! 🙂

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 7, 2021, 7:02pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/2 "2021-07-07T19:02:23Z")

</div>

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

```julia
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

```

 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/0/2/0202842735a1d272e5db6225b352a03926bdb979.png)

---

<div class="post-metadata">

**Author:** ![Nick\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nick_k/32/26912_2.png) [@Nick\_k](https://discourse.julialang.org/u/Nick_k)\
**Post date:** [July 7, 2021, 7:39pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/3 "2021-07-07T19:39:40Z")

</div>

Thank you very much Jules, this produces exactly the output I want. However, I really do need to solve this problem using Plots.jl ☹ . 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! 🙂

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 7, 2021, 8:00pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/4 "2021-07-07T20:00:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [July 7, 2021, 8:12pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/5 "2021-07-07T20:12:27Z")

</div>

A Plots.jl solution.

```julia
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)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/1/01976551653c1405fc5ea5167bc109dd2030c094.jpeg)

---

<div class="post-metadata">

**Author:** ![Nick\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nick_k/32/26912_2.png) [@Nick\_k](https://discourse.julialang.org/u/Nick_k)\
**Post date:** [July 7, 2021, 9:23pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228/6 "2021-07-07T21:23:16Z")

</div>

Fantastic, thank you so much genkuroki!
