# Plot layout using Plots.jl

**URL:** https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819
**Category:** New to Julia
**Tags:** question, plots, layout-plots
**Created:** [June 15, 2022, 4:36pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819 "2022-06-15T16:36:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Aditya\_Rai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aditya_rai/32/35586_2.png) [@Aditya\_Rai](https://discourse.julialang.org/u/Aditya_Rai)
#### Post date: [June 15, 2022, 4:36pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/1 "2022-06-15T16:36:31Z")

</div>

Hello everyone,

I was trying too create a specific layout of plots as per my needs and ran into a problem. I am using plot.jl with GR backend. My current custom plot layout looks like this:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/2/42464625613b30ab4c626e6018c9f7e6f78007e1.png)

 ![Screenshot (12)](https://global.discourse-cdn.com/julialang/original/3X/d/9/d9bd676d97387e64ec3e0d471f71084948db1365.png)

However I want the last row of my layout to only occupy 50% of the total width and be center aligned. I couldn’t figure out a way to do this.

Any help would be appreciated. Thanks.

---

<div class="post-metadata">

### Author: ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)
#### Post date: [June 15, 2022, 8:58pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/2 "2022-06-15T20:58:57Z")

</div>

From memory, make the last row `_{0.25w} c{0.5w} _{0.5w}`

---

<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: [June 15, 2022, 9:42pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/3 "2022-06-15T21:42:32Z")

</div>

I didn’t manage to use @gustaphe’s elegant syntax but the brute force below works, FYI:

```julia
using Plots; gr()
l = @layout [grid(1,2){0.3h}; b{0.5h}; c{0.25w} d{0.5w} e]
p1 = p2 = heatmap(rand(100,20))
p3 = scatter(rand(10,2))
p5 = heatmap(rand(200,20), colorbar=nothing)
p4 = p6 = plot(frame=:none)
plot(p1,p2,p3,p4,p5,p6, layout=l)

```

---

<div class="post-metadata">

### Author: ![Aditya\_Rai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aditya_rai/32/35586_2.png) [@Aditya\_Rai](https://discourse.julialang.org/u/Aditya_Rai)
#### Post date: [June 15, 2022, 9:47pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/4 "2022-06-15T21:47:31Z")

</div>

Thanks for responding @gustaphe, I tried implementing your solution but I got this error:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/b/5b2274f5ed811324c023b6e1e08a95321e39c6a9.png)

“LoadError: When doing layout, n (6) != n\_override (4). You’re probably trying to force existing plots into a layout that doesn’t fit them.”

---

<div class="post-metadata">

### Author: ![Aditya\_Rai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aditya_rai/32/35586_2.png) [@Aditya\_Rai](https://discourse.julialang.org/u/Aditya_Rai)
#### Post date: [June 15, 2022, 9:52pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/5 "2022-06-15T21:52:42Z")

</div>

Thanks that did the trick! Thanks for your help @rafael.guerra.

---

<div class="post-metadata">

### Author: ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)
#### Post date: [June 15, 2022, 9:56pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819/6 "2022-06-15T21:56:29Z")

</div>

Hm, I looked it up, and the last paragraph of [Layouts · Plots](https://docs.juliaplots.org/latest/layouts/) suggests my memory is accurate. Someone should make an issue about that (Maybe it’s just that you can’t do the curlybrace thing yet, still a worthy feature request).
