# Makie, make axes invisible?

**URL:** <https://discourse.julialang.org/t/makie-make-axes-invisible/20796>\
**Category:** General Usage\
**Tags:** plotting, makie\
**Created:** [February 14, 2019, 9:34pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796 "2019-02-14T21:34:19Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 14, 2019, 9:34pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/1 "2019-02-14T21:34:19Z")

</div>

I really enjoy the fastness of Makie! I think it can really become the next generation plotting tool for Julia.  
Currently I am struggelling with the axis interface.  
Is there any convenient possibility to make the axes of a plot invisible?

For 3DAxis I found

```julia
scene = Scene()
lines!(scene, sin.(0:0.1:2*pi))
axis = scene[Axis]
axis[:showaxis] = (false, false, false)

```

and for 2DAxis I found the property `axis[:visible]`  
but neither the 2D nor the 3D versions work for me ☹

Currently I have the following workaround:

```julia
function axis_off(scene) 
    axis = scene[Axis]
    axis[:names][:axisnames] = ("","")
    axis[:grid][:linewidth] = (0, 0)
    axis[:ticks][:textsize] = (0, 0)
    scene
end

```

But I may be missing something …?  
Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![hhaensel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hhaensel/32/1207_2.png) [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Post date:** [February 15, 2019, 10:27am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/2 "2019-02-15T10:27:24Z")

</div>

Just realised, that

```julia
lines(sin.(0:0.1:2*pi), show_axis = false)

```

works, I must have had a typo somewhere, when trying the first time.  
I would still be interested in knowing whether I could switch axes plotting on/off after the plot has been made…

P.S.: a nice example for Valentine’s Day 😉

```julia
h(x) = abs(x)^(2/3) + sqrt(3.3-x^2) * cos(150*pi*x)
lines(h.(LinRange(-sqrt(3.3),sqrt(3.3),10000)), color = :red, show_axis=false)

```

---

<div class="post-metadata">

**Author:** ![Kolaru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kolaru/32/4574_2.png) [@Kolaru](https://discourse.julialang.org/u/Kolaru)\
**Post date:** [March 21, 2021, 1:10am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/3 "2021-03-21T01:10:26Z")

</div>

If you are using the `Axis` workflow, the way to hide everything is

```julia
ax = Axis() # customized as you see fit
hidedecorations!(ax) # hides ticks, grid and lables
hidespines!(ax) # hide the frame

```

as described in [the documentation](https://makie.juliaplots.org/stable/makielayout/axis.html#Hiding-Axis-Spines-and-Decorations).

Since this post is the first result I got from google I figured it may be worth updating it.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 21, 2021, 7:48am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/4 "2021-03-21T07:48:28Z")

</div>

To add to this, the reason is not that I like removing simple keywords, but that show\_axis controlled whether the plot object Axis2D or 3D was added to the scene or not, which is a binary yes no thing. Now, with the Axis that is a complex container object for a scene, that logic doesn’t work anymore, as the axis doesn’t have a single on/off switch as it did before, it’s always there

---

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [May 2, 2021, 11:25am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/5 "2021-05-02T11:25:48Z")

</div>

What is the way to turn axes off in a `LScene`?

---

<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:** [May 2, 2021, 3:08pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/6 "2021-05-02T15:08:26Z")

</div>

@mschauer, does [this](https://discourse.julialang.org/t/makie-how-to-hide-axes-while-plotting-text/40604) do it?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 2, 2021, 3:18pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/7 "2021-05-02T15:18:44Z")

</div>

LScene(scenekw = (show\_axis = false,))

---

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [April 11, 2023, 4:08pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/8 "2023-04-11T16:08:44Z")

</div>

What is the current way to do this?

---

<div class="post-metadata">

**Author:** ![alex-s-gardner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alex-s-gardner/32/30210_2.png) [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Post date:** [May 15, 2023, 3:45pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/9 "2023-05-15T15:45:38Z")

</div>

For hiding various axis and figure boarders, ticks and grids see Makie documentation for:

[hidexdecorations!](https://docs.makie.org/stable/api/index.html#hidexdecorations!)  
[hideydecorations!](https://docs.makie.org/stable/api/index.html#hideydecorations!)  
[hidedecorations!](https://docs.makie.org/stable/api/index.html#hidedecorations!)  
[hidespines!](https://docs.makie.org/stable/api/index.html#hidespines!)

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [June 17, 2023, 7:57am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/10 "2023-06-17T07:57:54Z")

</div>

By the way, would someone know how to only remove the grey background grid of a plot?  
`hidecorations` gets rid of it but also removes all axis information.

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [June 17, 2023, 8:22am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/11 "2023-06-17T08:22:55Z")

</div>

Use the keyword arguments of `hide[x,y]decorations!`, see the link above.

---

<div class="post-metadata">

**Author:** ![Gravlax](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Post date:** [June 17, 2023, 8:46am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/12 "2023-06-17T08:46:55Z")

</div>

I see, thanks! The following is lengthy but does the job.

```julia
  hidexdecorations!(ax; label = false, ticklabels = false, ticks = false, grid = true,
    minorgrid = false, minorticks = false)
  hideydecorations!(ax; label = false, ticklabels = false, ticks = false, grid = true,
    minorgrid = false, minorticks = false)

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [June 17, 2023, 9:44am UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/13 "2023-06-17T09:44:49Z")

</div>

You can directly set `xgridvisible = false` etc. on the Axis

---

<div class="post-metadata">

**Author:** ![mschauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mschauer/32/13946_2.png) [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Post date:** [May 9, 2024, 12:07pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/14 "2024-05-09T12:07:58Z")

</div>

Can we have a code snipped to copy and paste here?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [May 9, 2024, 1:11pm UTC](https://discourse.julialang.org/t/makie-make-axes-invisible/20796/15 "2024-05-09T13:11:43Z")

</div>

I actually don’t know what exactly people is looking to do but:

```julia
julia> using CairoMakie

julia> fig, ax = scatter(rand(3), rand(3)); hidedecorations!(ax); hidespines!(ax); fig

```

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