Makie, make axes invisible?

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

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 :frowning:

Currently I have the following workaround:

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.

2 Likes

Just realised, that

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 :wink:

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)
2 Likes

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

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

as described in the documentation.

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

1 Like

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

1 Like

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

@mschauer, does this do it?

LScene(scenekw = (show_axis = false,))

1 Like