Open asinghvi17 opened 1 year ago
I'm confused by this. Your example looks the same as
with_theme(theme_black()) do
sc2 = Scene()
sc2_c1 = Scene(sc2) # create a child Scene
lines!(sc2_c1, rand(10), rand(10))
sc2
end
which I assume should work, but doesn't produce a white line. Neither does just one scene. The theme has linecolor = :white
in it... Is this more broken now?
Scenes don't pass themes to children
Consider the following code:
This produces a white line, as you'd expect.
However, if we plot to a child Scene,
is not visible. However, if we look at
sc2_c1
,the line exists - but is black! Is this expected behaviour, that the child of a Scene will not inherit its theme? Do we want the toplevel Scene construct to be able to define the theme, or should we force users to set the same global theme for each scene?
This means that things like this don't work:
Instead, you have to construct all axes within the same theme for the figure to do what you intend it to do. Somehow, the axes retain their themes, but don't pass them on to their own
ax.scene
s outside thewith_theme
block.Old issue text
Consider the following: ```julia using Makie, TernaryDiagrams fig, ax, plt = with_theme(theme_black()) do ternaryaxis(; axis = (; aspect = AxisAspect(96/71))) end ``` ![download-5](https://user-images.githubusercontent.com/32143268/229275218-d42c47ad-b739-4acb-82f8-0bf2e0a35820.png) This works fine. If I only construct the figure in `with_theme`, though, ```julia fig = with_theme(theme_black()) do; Figure(); end; ax = Axis(fig[1, 1], aspect = AxisAspect(96/71)); ta = ternaryaxis!(ax); fig ``` ![download-4](https://user-images.githubusercontent.com/32143268/229275184-e4e9ed07-9d5c-4c3f-9d31-80861a3a6f7c.png) When I set the background colors of `fig` and `ax.scene` to white, and then redisplay, ![download-6](https://user-images.githubusercontent.com/32143268/229275256-34611da8-1f68-4504-9636-5a1fb562f0a6.png) which clearly indicates that the axis's scene has a different default theme than the Figure's scene. This shouldn't be happening. These should have the same result, but don't. Might be because blocks are using `theme(parent_scene)`, which doesn't get the actual theme of the parent scene. Will add a more minimal example later.