# Plot @layout adjust width of grid

My goal is a layout like:

@layout [grid(4,2) [b; c{0.166h}; d{0.166h}; e{0.166h}]]

which is a 4 x 2 grid on the left and a stack of 4 plots on the right. However, I want the left 4 x 2 grid to be 1/3 of the total width and the right stack to be 2/3 of the total width. I cannot get that to work. Any advice?

Here’d be one solution for Makie.jl as a fallback, I don’t know how to do it in Plots either:

``````f = Figure()
axs_left = [Axis(f[1, 1][i, j]) for i in 1:4, j in 1:2]
axs_right = [Axis(f[1, 2][i, 1]) for i in 1:4]
colsize!(f.layout, 1, Relative(1/3))
f
``````

1 Like

The OP’s example seems a bit more complex but the equivalent of @jules’ code in Plots.jl might be:

``````using Plots; gr(size=(1200,800), dpi=600)
h = fill(1/4, 4)
w = [1/6, 1/6, 2/3]
l = @layout [grid(4,3, heights=h, widths=w)]
p = fill(plot(), 4*3)
plot(p..., layout=l, framestyle=:box)
``````

Thanks, it is helpful to see how to modify the grid with optional heights and widths. However, what I am trying to do start with the following picture and then shrink the width of the 4x2 grid on the left and expand the width of the column on the right. Still don’t see how to do that.

Using Plots.jl:

``````using Plots; gr(size=(1200,800), dpi=600)
l = @layout [ grid(4, 2){0.33w} [b; c{0.166h}; d{0.166h}; e{0.166h}] ]
p = fill(plot(), 4*3)
plot(p..., layout=l, framestyle=:box)
``````

That worked. Thank you. I had tried various ways of adding the {w} spec before but must have input that modifier incorrectly. In any case, your solution shows the elegance of the @layout notation.