# Accessing LScene and Figure attributes from Makie Recipes

**URL:** <https://discourse.julialang.org/t/accessing-lscene-and-figure-attributes-from-makie-recipes/126320>\
**Category:** Visualization\
**Created:** [February 26, 2025, 3:51am UTC](https://discourse.julialang.org/t/accessing-lscene-and-figure-attributes-from-makie-recipes/126320 "2025-02-26T03:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonygem96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonygem96/32/27564_2.png) [@tonygem96](https://discourse.julialang.org/u/tonygem96)\
**Post date:** [February 26, 2025, 3:51am UTC](https://discourse.julialang.org/t/accessing-lscene-and-figure-attributes-from-makie-recipes/126320/1 "2025-02-26T03:51:33Z")

</div>

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

```julia
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.

```julia
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 

```

---

<div class="post-metadata">

**Author:** ![tonygem96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonygem96/32/27564_2.png) [@tonygem96](https://discourse.julialang.org/u/tonygem96)\
**Post date:** [January 12, 2026, 7:14pm UTC](https://discourse.julialang.org/t/accessing-lscene-and-figure-attributes-from-makie-recipes/126320/2 "2026-01-12T19:14:41Z")

</div>

See workaround posted here: [Issue: Passing `scenekw` Arguments in Makie Recipes - #5 by tonygem96](https://discourse.julialang.org/t/issue-passing-scenekw-arguments-in-makie-recipes/131945/5)
