Plots.jl @layout specify width dynamically

I assume this has a very simple solution, but I’m struggling.

I’m trying to set up a grid of plots with a non-standard layout using Plots.jl which I can do as follows:

x = rand(100, 4)
l = @layout [a{0.8w} grid(3, 1)]
plot(x, layout = l)

A large panel taking up 80% of the plot width, with 3 smaller panels along the side arranged in a column. However, I want the width to be dynamically generated, say e.g.

K = 5
x = rand(100, K)
l = @layout [a{(1 / K)w} grid(K - 1, 1)]
plot(x, layout = l)

However, the argument for the width of the large panel a{(1 / K)w} only appears to accept a specified float value, and won’t take a variable value.

Anyone know a way around this?

2 Likes

I would also be interested in knowing how to do that.

But, fyi, another way to achieve the same goal is:

K = 5
x = rand(100, K)
l = @layout [grid(1, 1, width=[1/K]) grid(K-1, 1)]
plot(x, layout=l)