# Layout with several grids

**URL:** <https://discourse.julialang.org/t/layout-with-several-grids/87474>\
**Category:** Visualization\
**Tags:** plots, gr, layout-plots\
**Created:** [September 19, 2022, 3:04pm UTC](https://discourse.julialang.org/t/layout-with-several-grids/87474 "2022-09-19T15:04:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [September 19, 2022, 3:04pm UTC](https://discourse.julialang.org/t/layout-with-several-grids/87474/1 "2022-09-19T15:04:49Z")

</div>

I am using Plots with GR backend and trying to create a 2x2 grid of plots with a common legend in the bottom.

As it happens, there is no support for horizontal legends with gr, so I am trying to add plots without a frame below my 2x2 grid. Since each subplot has 5 curves, I want to split the legend into 3 columns.

In principle, I am trying to specify the layout which looks like

```julia
@layout [grid(2,2)
         grid(1,3)]

```

Now, how do I specify the relative heights of the upper and lower grids?

It seems that horizontal legends are supported by GRUtils.jl. Is there a way to mix Plots.jl and GRUtils.jl?

---

<div class="post-metadata">

**Author:** ![t-bltg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/t-bltg/32/25526_2.png) [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Post date:** [November 7, 2022, 4:24pm UTC](https://discourse.julialang.org/t/layout-with-several-grids/87474/2 "2022-11-07T16:24:26Z")

</div>

Horizontal legends are now supported since `Plots@1.36.0` for the `GR` backend.

A long standing wished for feature ([Horizontal legends · Issue #2206 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/2206)).

EDIT: and now for `PyPlot` as well.

---

<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, 7:23pm UTC](https://discourse.julialang.org/t/layout-with-several-grids/87474/4 "2022-11-07T19:23:12Z")

</div>

> [@Gregstrq](#):
>
> how do I specify the relative heights of the upper and lower grids?

Like this:

```julia
@layout [grid(2,2){0.7h}; grid(1,3)]

```
