Is it possible to access figure level or LScene level attributes from a Makie recipe? For example, in the MWE below, myplot(::MyTypeA)
defaults to an LScene. Can I control show_axis=false from within the recipe? I understand that
fig, ax, mp = myplot(mytypea)
ax.show_axis[] = false
would work but ideally I want this plot to have this default behavior.
Similarly, setting the backlgroundcolor for an Axis plot (MyTypeB) from within the recipe seems impossible.
module MyPackage
export myplot, MyTypeA, MyTypeB
struct MyTypeA{T}
A::T
end
struct MyTypeB{T}
B::T
end
using Makie
@recipe(MyPlot, object) do scene
Theme()
end
Makie.args_preferred_axis(::Type{<:MyPlot},obj::MyTypeA) = LScene
Makie.args_preferred_axis(::Type{<:MyPlot},obj::MyTypeB) = Axis
function Makie.plot!(myplot::MyPlot{<:Tuple{MyTypeA}})
mytype = myplot[:object][]
scene = parent(myplot)
scene.backgroundcolor[] = to_color(:black)
scene.clear[] = true
meshscatter!(myplot, mytype.A, color=:gray)
return myplot
end
function Makie.plot!(myplot::MyPlot{<:Tuple{MyTypeB}})
mytype = myplot[:object][]
scene = parent(myplot)
scene.backgroundcolor[] = to_color(:black)
scene.clear[] = true
scatter!(myplot, mytype.B, color=:gray)
return myplot
end
end
using .MyPackage
using GLMakie
mytypea = MyTypeA(rand(300,3))
myplot(mytypea) # Black background but cannot do show_axis=false in recipe
mytypeb = MyTypeB(rand(300,2))
myplot(mytypeb) # Black background did not work