# Plots.jl using layout with shared xaxis

**URL:** https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350
**Category:** New to Julia
**Tags:** question, plotting, layout-plots
**Created:** [August 1, 2023, 12:38pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350 "2023-08-01T12:38:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![J\_I](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_i/32/46880_2.png) [@J\_I](https://discourse.julialang.org/u/J_I)
#### Post date: [August 1, 2023, 12:38pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350/1 "2023-08-01T12:38:57Z")

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

```julia
using Plots

x = range(0, step = 0.01, stop = 2pi)
y1 = sin.(x)
y2 = cos.(x)

plt1 = plot(x, y1)
plt2 = plot(x, y2)
plot(plt1, plt2, layout = (2, 1), framestyle=:box)

```

The results is follows.  
 ![test1](https://global.discourse-cdn.com/julialang/original/3X/4/8/48e142957cf4bda12d744328318e8d0831c22cfa.png)  
I want to make it shared axis, meaning that to remove x-label and numbers in the upper panel, but the ticks intact. How can I do this?

---

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [August 1, 2023, 12:49pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350/2 "2023-08-01T12:49:01Z")

</div>

> [@J\_I](#):
>
> to remove x-label and numbers in the upper panel, but the ticks intact. How can I do this?

In that example that would be

```julia
plt1 = plot(x, y1, xlabel="", xticks=(1:6, fill("", 6)))

```

---

<div class="post-metadata">

### Author: ![J\_I](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_i/32/46880_2.png) [@J\_I](https://discourse.julialang.org/u/J_I)
#### Post date: [August 1, 2023, 12:54pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350/3 "2023-08-01T12:54:21Z")

</div>

Thanks! It worked!

---

<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: [August 1, 2023, 8:07pm UTC](https://discourse.julialang.org/t/plots-jl-using-layout-with-shared-xaxis/102350/4 "2023-08-01T20:07:42Z")

</div>

Fyi, to get rid of the xtick labels you could also use `xformatter` keyword:

```julia
plt1 = plot(x, y1, xformatter=_->"")

```

PS: if you also would like to reduce the space between the subplots you need to use `Measures`.
