# Remove top or bottom axis in :box plot

**URL:** https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897
**Category:** Visualization
**Tags:** plotting, pyplot, plots
**Created:** [June 27, 2023, 3:01pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897 "2023-06-27T15:01:08Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)
#### Post date: [June 27, 2023, 3:01pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/1 "2023-06-27T15:01:08Z")

</div>

Hi there,

I’ve been searching for a way of doing this, but cannot find anything…

I’ve been trying to make a box plot but with a missing axis. Essentially, I would like to get the results given by

```julia
plot(framestyle = :box)

```

but with the top axis missing (or the bottom one missing). I can remove both the top and bottom x-axis at once, by doing something like

```julia
plot(framestyle = :box, xaxis = false)

```

but I would like to only remove either the top or the bottom.

Is there a way to do this?

Thanks!

---

<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: [June 27, 2023, 10:33pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/2 "2023-06-27T22:33:24Z")

</div>

Try something like:

```julia
using Plots
p = plot(sin, framestyle=:axis, widen=false)
vline!([xlims(p)[2]], lc=:black, lw=2)

```

---

<div class="post-metadata">

### Author: ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)
#### Post date: [June 28, 2023, 7:19am UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/3 "2023-06-28T07:19:25Z")

</div>

Hmm, yeah that could work, but I wonder if there is not a buit-in way of doing that.

Especially if I’d like to have tick marks on both sides and stuff like that.

But thanks for the idea!

---

<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: [June 28, 2023, 8:28am UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/4 "2023-06-28T08:28:08Z")

</div>

> [@cmdenis](#):
>
> Especially if I’d like to have tick marks on both sides and stuff like that.

The `:box` frame style doesn’t seem to provide tick marks on both sides, at least on GR backend.

---

<div class="post-metadata">

### Author: ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)
#### Post date: [June 28, 2023, 1:10pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/5 "2023-06-28T13:10:10Z")

</div>

Oh yeah, you’re totally right, I should’ve specified.

I’m using the PyPlot backend. You get tick marks on that backend.

```julia
pyplot()
plot(framestyle = :box)

```

produces

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

---

<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: [June 28, 2023, 9:40pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/6 "2023-06-28T21:40:56Z")

</div>

Ok, for such partial boxing using Plots.jl you could do:

```julia
using Plots; pyplot(dpi=100) # or: gr(), etc.
p = plot(sin, framestyle=:axes, widen=false)
plot!(twinx(p), grid=:on, ylims=ylims(p), yformatter=_->"")

```

![Plots_pyplot_partial_boxing](https://global.discourse-cdn.com/julialang/original/3X/7/8/783e918d59868d4f25625f76b01635ac2a4e8b46.png)

---

<div class="post-metadata">

### Author: ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)
#### Post date: [June 29, 2023, 12:31pm UTC](https://discourse.julialang.org/t/remove-top-or-bottom-axis-in-box-plot/100897/7 "2023-06-29T12:31:40Z")

</div>

Oh awesome! That’s what I was looking for.

Thanks!
