I am unable to pass scenekw arguments through a Makie recipe such that the LScene is constructed correctly.
Regardless of what I try, the result is always a perspective view with axes.
My understanding is that Makie recipes should handle this use case without requiring an LScene to be constructed beforehand.
However, the macros obscure what is happening internally, making it difficult to diagnose.
Below is a minimal working example:
using GLMakie, TestImages
@recipe(ImShow) do scene
Attributes(
interpolate = false,
camera = campixel!,
show_axis = false
)
end
Makie.args_preferred_axis(::Type{<: ImShow}, x) = Makie.LScene
Makie.preferred_axis_type(::ImShow) = Makie.LScene
function Makie.plot!(plt::ImShow)
img = plt[1][]
image!(plt, rotr90(img))
return plt
end
img = testimage("cameraman")
image_size = reverse(size(img))
f2 = Figure(size = image_size, figure_padding = 0)
imshow(f2[1, 1], img)
display(f2)
Unfortunately I think that this needed use case pattern is not supported. There not so many recipe examples for this use case, however. But if the plot recipe is to create an LScene, it seems that we should be able to control how it is created, no?
I tried to solve this by creating a Theme which set Figure and Scene properties, but it fails as well:
chart_theme = Theme(
Figure(figure_padding=0,),
Scene = (camera=campixel!,
show_axis=false,)
)
Just using the Figure as an example results in the errror:
chart_theme = Theme(
Figure(figure_padding=0,),
)
ERROR: MethodError: Cannot `convert` an object of type Figure to an object of type Dict{Symbol, Observable}
The function `convert` exists, but no method is defined for this combination of argument types.
Closest candidates are:
Dict{K, V}(::Any) where {K, V}
@ Base dict.jl:90
convert(::Type{T}, ::T) where T<:AbstractDict
@ Base abstractdict.jl:571
convert(::Type{T}, ::AbstractDict) where T<:AbstractDict
@ Base abstractdict.jl:573
...
Stacktrace:
[1] Attributes(attributes::Figure)
@ MakieCore ~/.julia/packages/MakieCore/hXATT/src/types.jl:51
[2] top-level scope
@ REPL[68]:1
[3] top-level scope
@ none:1
So is it not possible to apply themes to Figure or Scenes with Makie recipes? There seems to be no way to uniformly control padding or rendering.