Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme example for LScene in the documentation #4679

Closed
Luluser opened this issue Dec 18, 2024 · 2 comments · May be fixed by #4680
Closed

Theme example for LScene in the documentation #4679

Luluser opened this issue Dec 18, 2024 · 2 comments · May be fixed by #4680
Labels
documentation enhancement Feature requests and enhancements

Comments

@Luluser
Copy link

Luluser commented Dec 18, 2024

Feature description

As asked several time on the github, there is no documentation for tweaking LScenes.
With the right keywords, one can find that LScene().scene[OldAxis] allows to get access to some axis attributes that one can modify after the LScene block was initiated.
I would like to theme a LScene() for a recipe I am making, say axis name by default, its color and the ticks etc, but there is no documentation to do so.
The documentation gives in the Theme section :
Theming block objects

Every Block such as Axis, Legend, Colorbar, etc. can be themed by using its type name as a key in your theme.

Here is how you could define a simple ggplot-like style for your axes:

ggplot_theme = Theme(
    Axis = (
        backgroundcolor = :gray90,
        leftspinevisible = false,
        rightspinevisible = false,
        bottomspinevisible = false,
        topspinevisible = false,
        xgridcolor = :white,
        ygridcolor = :white,
    )
)

with_theme(example_plot, ggplot_theme)

But it is not obvious (possible ?) how to modify the working examples :

LScene_theme = Theme(
    LScene = ( 
        scene = (
            OldAxis = Dict(
                :names => (
                    axisnames = ("x-direction (m)", "y-direction", "z-direction")
                )
            )
        )
    )
)

Does not work and I am clueless on how to apply a function in the theme, say getindex to get the OldAxis object from the scene.
I believe, you wanted to ultimately give public attributes to the LScene like an Axis3 or a normal Axis, but in the meantime, the absence of accessible attributes or documentation makes it annoying to tweak !

@Luluser Luluser added the enhancement Feature requests and enhancements label Dec 18, 2024
@asinghvi17
Copy link
Member

asinghvi17 commented Dec 18, 2024

You can set the theme for Axis3D, which should do what you are looking for. If you have the time, a PR to the docs mentioning this would be great!

e.g.

using CairoMakie
set_theme!(Axis3D = (; names = (; axisnames = ("abc", "def", "ghi"), fontsize = (30, 20, 15))))
surface(Makie.peaks())
Image

There used to be a similar recipe called axis2d, but I can't find it now...

@Luluser
Copy link
Author

Luluser commented Dec 18, 2024

Thanks a lot for the quick answer, it does work. I just made the PR with the link to the issue, added your example and how to access the themable attributes of Axis3D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement Feature requests and enhancements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants