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

Fix errorbar and bracket interaction with transform functions #3012

Merged
merged 11 commits into from Jun 21, 2023

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Jun 16, 2023

Description

Fixes #3005 and #1455

I replaced scene_to_screen and screen_to_scene with plot_to_screen and screen_to_plot here, which includes applying the model matrix, transform function and considers plot.space. I changed the name because these functions are more closely related to what a plot is doing, and a plot can have different transformations (and coordinate space) than a scene.I'm also hoping it trips up CI if I missed some calls to the old functions.

This now also fixes some issues with bracket. On master it doesn't react to window resizing and it doesn't include transformations when calculating its positions.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@MakieBot
Copy link
Collaborator

MakieBot commented Jun 16, 2023

Compile Times benchmark

Note, 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))
using create display create display
GLMakie 10.21s (10.15, 10.29) 0.04+- 1.06s (1.01, 1.07) 0.02+- 778.51ms (764.79, 821.78) 20.79+- 10.34ms (10.25, 10.39) 0.05+- 88.07ms (87.37, 88.62) 0.43+-
master 10.18s (10.14, 10.24) 0.04+- 1016.84ms (997.02, 1054.92) 24.16+- 779.77ms (761.83, 787.66) 11.53+- 9.92ms (9.85, 9.99) 0.04+- 87.30ms (86.64, 87.83) 0.41+-
evaluation +0.28%, 0.03s invariant (0.73d, 0.20p, 0.04std) +3.82%, 0.04s slower X (1.78d, 0.01p, 0.02std) -0.16%, -1.26ms invariant (-0.07d, 0.89p, 16.16std) +4.06%, 0.42ms slower X (9.40d, 0.00p, 0.04std) +0.88%, 0.77ms slower X (1.85d, 0.00p, 0.42std)
CairoMakie 8.30s (8.26, 8.34) 0.03+- 1.15s (1.13, 1.16) 0.01+- 241.73ms (238.93, 244.77) 2.20+- 9.46ms (9.38, 9.52) 0.05+- 5.44ms (5.39, 5.50) 0.04+-
master 8.35s (8.30, 8.40) 0.04+- 1.14s (1.13, 1.15) 0.01+- 243.91ms (241.10, 246.32) 1.92+- 9.40ms (9.20, 9.48) 0.10+- 5.28ms (5.25, 5.31) 0.02+-
evaluation -0.63%, -0.05s faster ✓ (-1.41d, 0.02p, 0.04std) +0.17%, 0.0s invariant (0.19d, 0.73p, 0.01std) -0.90%, -2.18ms invariant (-1.06d, 0.07p, 2.06std) +0.62%, 0.06ms invariant (0.76d, 0.19p, 0.07std) +2.96%, 0.16ms slower X (4.85d, 0.00p, 0.03std)
WGLMakie 14.06s (13.90, 14.18) 0.09+- 1.60s (1.54, 1.64) 0.03+- 14.34s (14.19, 14.52) 0.11+- 18.87ms (16.41, 26.78) 3.55+- 1.07s (1.02, 1.15) 0.05+-
master 14.09s (13.89, 14.16) 0.09+- 1.57s (1.54, 1.60) 0.02+- 14.40s (14.33, 14.50) 0.06+- 16.70ms (15.97, 17.43) 0.57+- 1.04s (1.01, 1.10) 0.03+-
evaluation -0.20%, -0.03s invariant (-0.32d, 0.57p, 0.09std) +1.64%, 0.03s invariant (1.00d, 0.09p, 0.03std) -0.40%, -0.06s invariant (-0.65d, 0.25p, 0.08std) +11.50%, 2.17ms noisy🤷‍♀️ (0.85d, 0.16p, 2.06std) +2.99%, 0.03s invariant (0.78d, 0.17p, 0.04std)

@ffreyer ffreyer changed the title Fix errorbar interaction with transform functions Fix errorbar and bracket interaction with transform functions Jun 17, 2023
Comment on lines +110 to +115
# Avoid scale!() / translate!() / rotate!() to affect these
series!(pl, bp; space = :pixel, solid_color = pl.color, linewidth = pl.linewidth,
linestyle = pl.linestyle, transformation = Transformation())
text!(pl, textpoints, text = texts, space = :pixel, align = pl.align, offset = textoffset_vec,
fontsize = pl.fontsize, font = pl.font, rotation = autorotations, color = pl.textcolor,
justification = pl.justification)
justification = pl.justification, model = Mat4f(I))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently space = :pixel still includes model transformation (at least in GLMakie). Since plot_to_screen deals with them now, they'd be included twice. To prevent that I'm overwriting model/transformation. I'm using transformation for series because model doesn't get passed down.

Comment on lines -190 to -191
whiskers = lift(plot, linesegpairs, scene.camera.projectionview,
scene.camera.pixel_space, whiskerwidth) do pairs, _, _, whiskerwidth
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With camera.pixel_space this sometimes fails to update correctly when zooming or resizing. scene.px_area works fine.

@github-actions
Copy link
Contributor

Missing reference images

Found 1 new images without existing references.
Upload new reference images before merging this PR.

@jkrumbiegel jkrumbiegel merged commit 8ccb6bd into master Jun 21, 2023
14 checks passed
@jkrumbiegel jkrumbiegel deleted the ff/fix_errorbars branch June 21, 2023 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Whisker width on error bars does not work as expected on log scale plot.
3 participants