# \#layout-plots

**URL:** https://discourse.julialang.org/tag/layout-plots/1195.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [How to adjust the spacing for a plot's title and a plot's legend using Plots.jl?](https://discourse.julialang.org/t/how-to-adjust-the-spacing-for-a-plots-title-and-a-plots-legend-using-plots-jl/104667)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 1\
**Last updated:** [October 8, 2023, 3:28pm UTC](https://discourse.julialang.org/t/how-to-adjust-the-spacing-for-a-plots-title-and-a-plots-legend-using-plots-jl/104667 "2023-10-08T15:28:50Z")

</div>

I am working with Plots.jl and I’d like to have more flexibility to adjust the spacings in the plots. I provide below a short piece of code that requires Plots.jl as an example that serves to drive the point home. For t…

---

## [Plots.jl using layout with shared xaxis](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350)

<div class="topic-metadata">

**Author:** [@J\_I](https://discourse.julialang.org/u/J_I)\
**Replies:** 3\
**Last updated:** [August 1, 2023, 8:07pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350 "2023-08-01T20:07:42Z")

</div>

Hello. I’m in a bit trouble with Plots.jl uisng layout. May be this is a basic question, but I can’t find the solution in the document. I want to make the multiple plot with several panels sharing the same x axis. MWE is…

---

## [Plot layout with parametrized number of rows/columns](https://discourse.julialang.org/t/plot-layout-with-parametrized-number-of-rows-columns/100702)

<div class="topic-metadata">

**Author:** [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Replies:** 5\
**Last updated:** [June 23, 2023, 9:04am UTC](https://discourse.julialang.org/t/plot-layout-with-parametrized-number-of-rows-columns/100702 "2023-06-23T09:04:41Z")

</div>

Hi all I would like to incrementally build a plot from different subplots using layout. The issue I’m struggling with is that the number of subplots is a parameter/variable. So I would like to build a list of subplots, …

---

## [Plot in plot at grdipoint using Plots.jl](https://discourse.julialang.org/t/plot-in-plot-at-grdipoint-using-plots-jl/98002)

<div class="topic-metadata">

**Author:** [@psterzinger](https://discourse.julialang.org/u/psterzinger)\
**Replies:** 2\
**Last updated:** [April 28, 2023, 7:11am UTC](https://discourse.julialang.org/t/plot-in-plot-at-grdipoint-using-plots-jl/98002 "2023-04-28T07:11:07Z")

</div>

I am trying to make a plot, in which I want to position another shrunk plot at certain coordinates of my first plot (MWE below). Following the example at the end of the Layouts manual, I can, given a base plot p, use P…

---

## [Combining or reusing subplot elements](https://discourse.julialang.org/t/combining-or-reusing-subplot-elements/96606)

<div class="topic-metadata">

**Author:** [@iabraham](https://discourse.julialang.org/u/iabraham)\
**Replies:** 0\
**Last updated:** [March 25, 2023, 8:05pm UTC](https://discourse.julialang.org/t/combining-or-reusing-subplot-elements/96606 "2023-03-25T20:05:53Z")

</div>

How can I extract and reuse/combine subplots in Julia? Consider: pp = plot(0:0.01:2, \[sin.(0:0.01:2), cos.(0:0.01:2)\], layout=(1,2)); gg = plot(0:0.01:2, \[sin.(0:0.01:2).^2, cos.(0:0.01:2).^2\], layout=(1,2)); Both pp …

---

## [Plots.jl @layout specify width dynamically](https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017)

<div class="topic-metadata">

**Author:** [@nathancunn](https://discourse.julialang.org/u/nathancunn)\
**Replies:** 1\
**Last updated:** [November 7, 2022, 8:25pm UTC](https://discourse.julialang.org/t/plots-jl-layout-specify-width-dynamically/21017 "2022-11-07T20:25:15Z")

</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: x = rand(100, 4) l = @layout \[a{0.8w} grid(3, 1)\] …

---

## [Plots: subplot size changes when nesting plots with subplots & layout](https://discourse.julialang.org/t/plots-subplot-size-changes-when-nesting-plots-with-subplots-layout/61287)

<div class="topic-metadata">

**Author:** [@vandenman](https://discourse.julialang.org/u/vandenman)\
**Replies:** 0\
**Last updated:** [May 17, 2021, 9:14am UTC](https://discourse.julialang.org/t/plots-subplot-size-changes-when-nesting-plots-with-subplots-layout/61287 "2021-05-17T09:14:32Z")

</div>

So I’m having an issue when I put a plot with a layout into another plot. Consider the following example, my actual code is different (e.g., more pretty plotting and meaningful content), but this shows the problem alrea…

---

## [Layout with several grids](https://discourse.julialang.org/t/layout-with-several-grids/87474)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 2\
**Last updated:** [November 7, 2022, 7:23pm UTC](https://discourse.julialang.org/t/layout-with-several-grids/87474 "2022-11-07T19:23:12Z")

</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 fram…

---

## [Plotting layout problem with xaxis](https://discourse.julialang.org/t/plotting-layout-problem-with-xaxis/85712)

<div class="topic-metadata">

**Author:** [@Rev0c\_Devs](https://discourse.julialang.org/u/Rev0c_Devs)\
**Replies:** 3\
**Last updated:** [August 14, 2022, 5:46pm UTC](https://discourse.julialang.org/t/plotting-layout-problem-with-xaxis/85712 "2022-08-14T17:46:35Z")

</div>

Hi, I am trying to plot two figures in a layout. layout is set to layout = (2,1), and I got a problem with xaxis. the top of xaxis appears in the bottom figure. Is there any way to fix this? Thank you.

---

## [Plot layout using Plots.jl](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819)

<div class="topic-metadata">

**Author:** [@Aditya\_Rai](https://discourse.julialang.org/u/Aditya_Rai)\
**Replies:** 5\
**Last updated:** [June 15, 2022, 9:56pm UTC](https://discourse.julialang.org/t/plot-layout-using-plots-jl/82819 "2022-06-15T21:56:29Z")

</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: However I want the last…

---

## [Plot lines in the gaps between subplots](https://discourse.julialang.org/t/plot-lines-in-the-gaps-between-subplots/80172)

<div class="topic-metadata">

**Author:** [@chunjiw](https://discourse.julialang.org/u/chunjiw)\
**Replies:** 3\
**Last updated:** [May 2, 2022, 9:34pm UTC](https://discourse.julialang.org/t/plot-lines-in-the-gaps-between-subplots/80172 "2022-05-02T21:34:04Z")

</div>

Is it possible to plot lines in the gaps between subplots? For example, the two black lines indicating that the bottom plot is a zoom-in view of the top plot: Thanks for any help!

---

## [Julia plots layout](https://discourse.julialang.org/t/julia-plots-layout/80221)

<div class="topic-metadata">

**Author:** [@francesco123212](https://discourse.julialang.org/u/francesco123212)\
**Replies:** 1\
**Last updated:** [April 28, 2022, 9:13pm UTC](https://discourse.julialang.org/t/julia-plots-layout/80221 "2022-04-28T21:13:33Z")

</div>

Hi everyone, I currently am working on a plot with 3 rows of plots, using layout = layout(3,1). My issue is related to the x axis mismatch between the first diagram and the other 2; how should I fix it? thankyou in …

---

## [Layouts of a plot and of the same in a subplot](https://discourse.julialang.org/t/layouts-of-a-plot-and-of-the-same-in-a-subplot/76901)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 2\
**Last updated:** [February 22, 2022, 3:10pm UTC](https://discourse.julialang.org/t/layouts-of-a-plot-and-of-the-same-in-a-subplot/76901 "2022-02-22T15:10:57Z")

</div>

Continuing the discussion from Plot size from subplots sizes ! The discussion was about the layout changes illustrated below. The first plot was good-looking, but the combination in subplots was not. A useful workarou…

---

## [Is the Plots.jl layout broken?](https://discourse.julialang.org/t/is-the-plots-jl-layout-broken/75819)

<div class="topic-metadata">

**Author:** [@AdamWysokinski](https://discourse.julialang.org/u/AdamWysokinski)\
**Replies:** 5\
**Last updated:** [February 4, 2022, 9:24pm UTC](https://discourse.julialang.org/t/is-the-plots-jl-layout-broken/75819 "2022-02-04T21:24:24Z")

</div>

Hi, All packages updated, using gr() backend, the command plot(margins=0cm, layout=@layout \[a{0.125h} b;c\]) gives the following result: using pyplot() the result is slightly better, but still far from good: Ho…

---

## [Plot @layout adjust width of grid](https://discourse.julialang.org/t/plot-layout-adjust-width-of-grid/72527)

<div class="topic-metadata">

**Author:** [@evolbio](https://discourse.julialang.org/u/evolbio)\
**Replies:** 5\
**Last updated:** [December 4, 2021, 11:33am UTC](https://discourse.julialang.org/t/plot-layout-adjust-width-of-grid/72527 "2021-12-04T11:33:27Z")

</div>

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…

---

## [Specific layout for @layout macro in Plots.jl](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228)

<div class="topic-metadata">

**Author:** [@Nick\_k](https://discourse.julialang.org/u/Nick_k)\
**Replies:** 5\
**Last updated:** [July 7, 2021, 9:23pm UTC](https://discourse.julialang.org/t/specific-layout-for-layout-macro-in-plots-jl/64228 "2021-07-07T21:23:16Z")

</div>

I’m trying to generate a rather specific custom layout with the @layout macro. I’ve checked the documentation (http://docs.juliaplots.org/latest/layouts/#advanced-layouts), but it’s rather sparse and doesn’t quite give m…

---

## [Plots.jl horizontal and vertical labels across subplots in grid layout](https://discourse.julialang.org/t/plots-jl-horizontal-and-vertical-labels-across-subplots-in-grid-layout/60113)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 5\
**Last updated:** [April 27, 2021, 7:23pm UTC](https://discourse.julialang.org/t/plots-jl-horizontal-and-vertical-labels-across-subplots-in-grid-layout/60113 "2021-04-27T19:23:55Z")

</div>

using Plots n\_from = 2 n\_to = 3 froms = \[Plots.fakedata(100) for i = 1:n\_from\] tos = \[Plots.fakedata(100) for i = 1:n\_to\] gl = grid(n\_from + 1 , n\_to + 1) p = plot(;layout = gl, aspect\_ratio = 1.0) # setup subplots f…

---

## [How to plot distinct plots in grid layout](https://discourse.julialang.org/t/how-to-plot-distinct-plots-in-grid-layout/56242)

<div class="topic-metadata">

**Author:** [@xyz1](https://discourse.julialang.org/u/xyz1)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 12:59pm UTC](https://discourse.julialang.org/t/how-to-plot-distinct-plots-in-grid-layout/56242 "2021-03-01T12:59:04Z")

</div>

Hi, I’m trying to visualize some data with Plots.jl and even with the amazing Plots documentation i am unable to plot a grid (2,2) of plots. Specifically I would like to create something like using Plots plot(rand(100,…

---

## [How to use @layout in plots?](https://discourse.julialang.org/t/how-to-use-layout-in-plots/53722)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 3\
**Last updated:** [January 22, 2021, 12:12pm UTC](https://discourse.julialang.org/t/how-to-use-layout-in-plots/53722 "2021-01-22T12:12:40Z")

</div>

Hello, I am trying to create layouts for subplots, which are not pure grids. However, I find very little instructions on this. What I have found is a small section in the docs (Layouts · Plots which also contains a brok…

---

## [Plot in even grid layout when the number of subplots is prime (using Plots.jl)](https://discourse.julialang.org/t/plot-in-even-grid-layout-when-the-number-of-subplots-is-prime-using-plots-jl/53206)

<div class="topic-metadata">

**Author:** [@Sh4pe](https://discourse.julialang.org/u/Sh4pe)\
**Replies:** 2\
**Last updated:** [January 13, 2021, 9:40am UTC](https://discourse.julialang.org/t/plot-in-even-grid-layout-when-the-number-of-subplots-is-prime-using-plots-jl/53206 "2021-01-13T09:40:36Z")

</div>

Hi there! I’m using Plots.jl and I’m trying to customize a layout. I want to draw some plots in a grid layout, kind of like they are arranged when I don’t specify a layout at all. Say we have the following situation: l…

---

## [How to make top title in group layout plot?](https://discourse.julialang.org/t/how-to-make-top-title-in-group-layout-plot/50046)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [November 12, 2020, 3:28pm UTC](https://discourse.julialang.org/t/how-to-make-top-title-in-group-layout-plot/50046 "2020-11-12T15:28:25Z")

</div>

Hello! I have this plot: How would I make a title above both of them called “My Plot”? These are the basic commands I use: l = @layout grid(2,1) pall = plot(p1,p2, layout = l,size=(800,800)) If I try using the “…

---

## [Common legend using layouts](https://discourse.julialang.org/t/common-legend-using-layouts/45553)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 4\
**Last updated:** [August 28, 2020, 1:07pm UTC](https://discourse.julialang.org/t/common-legend-using-layouts/45553 "2020-08-28T13:07:57Z")

</div>

Dear all, I am plotting this: plot(rand(32,10), layout = (2,5), legend=false) plot!(rand(32,10), layout = (2,5), legend=false) And I’d like to have just one legend saying what the blue lines stand for and what the ora…

---

## [Grid layout for multiple plots](https://discourse.julialang.org/t/grid-layout-for-multiple-plots/37528)

<div class="topic-metadata">

**Author:** [@Farhan\_Samir](https://discourse.julialang.org/u/Farhan_Samir)\
**Replies:** 2\
**Last updated:** [April 13, 2020, 8:42pm UTC](https://discourse.julialang.org/t/grid-layout-for-multiple-plots/37528 "2020-04-13T20:42:54Z")

</div>

Hi, I’m trying to create a 2 by 10 grid of plots. The Plots documentation provides an example for a 2x2 grid: plot(rand(10,4), layout=grid(2,2),ticks=nothing) However, extending this to plot(rand(10,20),layout=grid(2…

---

## [How layout scatter plots on a grid layout?](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [June 24, 2019, 12:42pm UTC](https://discourse.julialang.org/t/how-layout-scatter-plots-on-a-grid-layout/25601 "2019-06-24T12:42:24Z")

</div>

Say I have 3 scatter plots and I want to lay them out in a 3 by 1 grid. How do I achiege that with Plots.jl? The @layout only shows examples of random data, but if I want to do it using specified plots e.g. x = rand(10…

---

## [Plots.jl @layout macro usage](https://discourse.julialang.org/t/plots-jl-layout-macro-usage/11024)

<div class="topic-metadata">

**Author:** [@standarddeviant](https://discourse.julialang.org/u/standarddeviant)\
**Replies:** 1\
**Last updated:** [May 20, 2018, 3:44pm UTC](https://discourse.julialang.org/t/plots-jl-layout-macro-usage/11024 "2018-05-20T15:44:40Z")

</div>

I’m trying to use Plots.jl to create a custom layout with the slick @layout macro. The only docs I see are here: http://docs.juliaplots.org/latest/layouts/#advanced-layouts What I’d like to do is have a plot that has …
