# Create plot layout with no separation between plots

**URL:** <https://discourse.julialang.org/t/create-plot-layout-with-no-separation-between-plots/91976>\
**Category:** Visualization\
**Tags:** plotting, plots\
**Created:** [December 21, 2022, 9:06pm UTC](https://discourse.julialang.org/t/create-plot-layout-with-no-separation-between-plots/91976 "2022-12-21T21:06:07Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Pablo\_Marchant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablo_marchant/32/32828_2.png) [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Post date:** [December 22, 2022, 1:32pm UTC](https://discourse.julialang.org/t/create-plot-layout-with-no-separation-between-plots/91976/4 "2022-12-22T13:32:12Z")

</div>

Thanks Rafael, indeed this could serve me as a workaround now but seems I do need to switch to `Makie` on the long run. In particular I noticed that a combination of bottom\_margin and top\_margin can remove the separation entirely, but the final result changes depending on the precise margins used. For instance, the following

```julia
using Plots

xvals = rand(10)
yvals = rand(10)

l = @layout [a{0.3h}
    b]

p1 = plot(xvals,yvals,xformatter=Returns(""))
p2 = plot(xvals,yvals,xformatter=Returns(""))

plot(p2,p1,layout=l, grid=false, bottom_margin = [-20mm 0mm], top_margin = [0mm -20mm])

savefig("example.png")

p1 = plot(xvals,yvals,xformatter=Returns(""))
p2 = plot(xvals,yvals,xformatter=Returns(""))

plot(p2,p1,layout=l, grid=false, bottom_margin = [-5mm 0mm], top_margin = [0mm -5mm])

savefig("example2.png")

```

Produces these two

![example2](https://global.discourse-cdn.com/julialang/original/3X/b/2/b2a9163ad9e19a037e13aaa1db7fdda6ddebd10c.png)  
 ![example](https://global.discourse-cdn.com/julialang/original/3X/2/8/28ff28ea355245ff3a2f444ea8bcda27e3703650.png)

the difference is small, it just modified the relative sizes of each panel, which in this case can work. But I can see how difficult this will be to handle with multi-panel situations where precise sizing is a must. I also noticed that for some reason this becomes very finicky if I combine it with `twinx()`.

My minor grievance with `Makie` is that it does not allow to plot ticks on all four sides, which I can do in `Plots` by abusing `twinx()` and `twiny()`.

---

_[View the full topic](https://discourse.julialang.org/t/create-plot-layout-with-no-separation-between-plots/91976)._
