Accessing axis in Makie plot recipes

Is there a way to access the axis in a Makie plot recipe? I’d like to apply xlims!(ax, ...) and set ax.aspect = .....

1 Like

Not yet, no. This is one part of the ongoing refactor of plot types and recipes, because when they were written there was no Axis.

3 Likes

What about just applying a theme to the Axis, not a full programmatic access to it? For instance, I was hoping that in this recipe the newly created Axis would have a certain background color, etc, but it seems the theme information was not used in any way.

struct TestStruct
    data
end

ts = TestStruct([1,2,3])

@recipe(TestRecipe) do scene
    Theme(
    Axis = (
        backgroundcolor = :gray90,
        leftspinevisible = false,
        rightspinevisible = false,
        bottomspinevisible = false,
        topspinevisible = false,
        xgridcolor = :white,
        ygridcolor = :white,
    )
    )
end

function Makie.plot!(tr::TestRecipe{<:Tuple{TestStruct}})
    data = tr[1][].data
    scatter!(tr, data, data*2)
    tr
end

testrecipe(ts)

@jules any update on this refactor of the recipe system to allow for more customization of the axis, the legend, the subplots in a layout, etc?

4 Likes

Any updates here? I want to customize the title of the plot since the info is embedded in the struct I want to plot.