-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Fully flatten plots and sort by atomic zorder in all backends #2793
Conversation
I have a recipe which plots multiple polys, and translates them based on a parameter. The idea is that only one poly has color, the rest only have stroke and the color is transparent, and they should all be seen as an overlay. It turns out that CairoMakie only orders by the z-value of plots in `scene.plots`, so any translation within a recipe (or by a user of a recipe's plots) is not respected. This commit fixes that by making `get_all_plots` truly recursive. Now, it only stops if a dispatch is defined on a particular plot type, or if `plot.children` is empty, in which case it's treated as an atomic plot. This seems to produce the correct results for my recipe.
Compile Times benchmarkNote, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running: using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(display(fig))
|
Ok, pushed the desired refactor, hopefully it's ok like this now! :) |
Recipes don't seem to work in |
You can move it outside the |
Missing reference imagesFound 1 new images without existing references. |
Yeah, I could have but didn't want to pollute the main namespace, so settled for bootlegging a recipe by plotting into another plot. |
Missing reference imagesFound 1 new images without existing references. |
I thought this fixes a bug only happening in recipes? |
It's general to any nested plot, because of the way they were flattened in CairoMakie - we only sorted by z-level of the topmost recipe (whatever was in I tested this on a version of CairoMakie without this patch. It showed only blue (the translation on the red plot had no effect). |
get_all_plots
in CairoMakie fully flatten plots
Description
I have a recipe which plots multiple polys, and translates them based on a parameter. The idea is that only one poly has color, the rest only have stroke and the color is transparent, and they should all be seen as an overlay.
It turns out that CairoMakie only orders by the z-value of plots in
scene.plots
, so any translation within a recipe (or by a user of a recipe's plots) is not respected.This commit fixes that by making
get_all_plots
truly recursive. Now, it only stops if a dispatch is defined on a particular plot type, or ifplot.plots
is empty, in which case it's treated as an atomic plot.This seems to produce the correct results for my recipe.
Fixes #2792
Type of change
Checklist