# Julia plots layout

**URL:** <https://discourse.julialang.org/t/julia-plots-layout/80221>\
**Category:** General Usage\
**Tags:** plots, layout-plots\
**Created:** [April 28, 2022, 4:44pm UTC](https://discourse.julialang.org/t/julia-plots-layout/80221 "2022-04-28T16:44:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![francesco123212](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@francesco123212](https://discourse.julialang.org/u/francesco123212)\
**Post date:** [April 28, 2022, 4:44pm UTC](https://discourse.julialang.org/t/julia-plots-layout/80221/1 "2022-04-28T16:44:47Z")

</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?

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/8/78209009e9d82a8f10585f6506667dd50791fec0.png)

thankyou in advance!

---

<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:** [April 28, 2022, 9:13pm UTC](https://discourse.julialang.org/t/julia-plots-layout/80221/2 "2022-04-28T21:13:33Z")

</div>

A workaround is to draw blank legends of appropriate length:

```julia
using Measures, Plots; gr()

l = @layout [a{0.5h}; b{0.25h}; c]

p1 = plot(sin, label="sin", legend=:outertopright)
plot!(cos, label="cos")

p2 = plot(cosh, c=:red)
plot!([1],[NaN], label=" "^4, c=:white, legend=:outertopright, fg_legend=:transparent)

p3 = plot(atan, legend=false, c=:green)
plot!([1],[NaN], label=" "^4, c=:white, legend=:outertopright, fg_legend=:transparent)

p = plot(p1, p2, p3, link=:x, layout=l, margin=0mm)
for i=1:2; plot!(p[i],xformatter=_->""); end; p

```

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

_ **NB:** _  
_Simplifed the xtick labels removal part using [this solution](https://discourse.julialang.org/t/avoid-repeating-tick-labels-with-subplots-in-plots-jl/351/2) from the master @tbreloff._
