# Plots.jl @layout specify width dynamically

**URL:** https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017
**Category:** General Usage
**Tags:** plots, layout-plots
**Created:** [February 20, 2019, 5:10pm UTC](https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017 "2019-02-20T17:10:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nathancunn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nathancunn/32/3165_2.png) [@nathancunn](https://discourse.julialang.org/u/nathancunn)
#### Post date: [February 20, 2019, 5:10pm UTC](https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017/1 "2019-02-20T17:10:57Z")

</div>

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:

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

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

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [November 7, 2022, 8:25pm UTC](https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017/2 "2022-11-07T20:25:15Z")

</div>

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

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

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

```
