Coloring background planes of 3d plot in Makie

I’m making a 3d plot, like the one shown below, but I can’t figure out how to color the background planes (or the “axis planes”, not sure what to call them). Changing the Figure() background colors the entire scene’s background (not what I want) and setting backgroundcolor=:red in the Axis3D doesn’t change anything. My reading of the docs says this should work, but it doesn’t. Am I misunderstanding something? (MWE example is not the same as the figure shown, to keep the length of the post shorter.)

using GLMakie

# Create your figure and axis
fig = Figure()
ax = Axis3(fig[1, 1],backgroundcolor=:red) # backgroundcolor=:red doesn't do anything


x = y = range(-5, 5, length=50)
z = [sin(sqrt(x^2 + y^2)) for x in x, y in y]
surface!(ax, x, y, z)
display(fig)

I read them the same way you do. xypanelcolor, xzpanelcolor and yzpanelcolor just blank the entire figure. I didn’t see anything in github issues on this.

It seems like the background color on the panel ‘walls’ are getting clipped. The following works, although it may have some unintended other side effects regarding display outside the display area:

fig = Figure()
ax = Axis3(fig[1, 1]; 
     xypanelcolor = :red, 
     xzpanelcolor = :red, 
     yzpanelcolor = :red, 
     clip = false
) 

x = y = range(-5, 5, length=50)
z = [sin(sqrt(x^2 + y^2)) for x in x, y in y]
surface!(ax, x, y, z)
display(fig)

2 Likes

If having the panels the same color as the scene is acceptable that can be accomplished more simply with

using GLMakie

# Create your figure and axis
fig = Figure(backgroundcolor=:red)
ax = Axis3(fig[1, 1])


x = y = range(-5, 5, length=50)
z = [sin(sqrt(x^2 + y^2)) for x in x, y in y]
surface!(ax, x, y, z)
display(fig)