Makie.jl icon indicating copy to clipboard operation
Makie.jl copied to clipboard

Fix issues with explicitly transformed recipes in DataInspector

Open ffreyer opened this issue 1 year ago • 1 comments

Description

Fixes #3526

With a plot structure like

recipe_plot
  primitive

where recipe_plot does not implement it's own show_data method, DataInspector will fall back on show_data for primitive. There it will assume that the input data of the primitive plot is in data space. If the recipe_plot handles the transform function directly, passing the result to primitive, the assumption that the input data is in data space is not correct. So you get incorrect labels.

This should affect every recipe plot that applies transform_func before creating child plots. That is:

  • [ ] h/vlines
  • [ ] h/vspan
  • ~~maybe barplot~~
  • [ ] bracket not inspectable at all?
  • [ ] contours (also missplaced)
  • [ ] error/rangebars (also missplaced)
  • [ ] poly
  • [ ] text with lines (tex) not inspectable at all?
  • ~~tooltip~~ (skipping this since it's unlikely to get inspected)
  • [ ] triplot (also bad limits)
  • [ ] voronoiplot (also bad limits)

Type of change

  • [x] 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.

ffreyer avatar Jan 14 '24 13:01 ffreyer

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(fig)
using create display create display
GLMakie 3.37s (3.33, 3.38) 0.02+- 386.40ms (371.86, 397.63) 9.46+- 469.57ms (462.32, 501.40) 14.09+- 7.00ms (6.92, 7.08) 0.06+- 25.16ms (25.09, 25.28) 0.06+-
master 3.36s (3.35, 3.37) 0.01+- 394.16ms (389.44, 399.07) 3.29+- 462.31ms (459.51, 465.63) 2.25+- 7.03ms (6.96, 7.10) 0.05+- 25.19ms (25.10, 25.27) 0.07+-
evaluation 1.00x invariant, 0.0s (0.25d, 0.65p, 0.01std) 1.02x invariant, -7.76ms (-1.10d, 0.08p, 6.37std) 0.98x invariant, 7.26ms (0.72d, 0.22p, 8.17std) 1.01x invariant, -0.04ms (-0.65d, 0.25p, 0.05std) 1.00x invariant, -0.03ms (-0.45d, 0.42p, 0.06std)
CairoMakie 3.06s (3.03, 3.09) 0.03+- 321.41ms (316.11, 331.78) 6.03+- 140.37ms (138.78, 143.90) 1.72+- 7.20ms (7.17, 7.25) 0.03+- 609.54μs (604.51, 614.89) 3.71+-
master 3.04s (3.02, 3.09) 0.02+- 320.18ms (316.84, 326.16) 3.08+- 140.13ms (138.98, 140.99) 0.77+- 7.20ms (7.14, 7.28) 0.05+- 605.22μs (600.89, 607.96) 2.65+-
evaluation 0.99x invariant, 0.02s (0.70d, 0.21p, 0.03std) 1.00x invariant, 1.23ms (0.26d, 0.64p, 4.55std) 1.00x invariant, 0.24ms (0.18d, 0.75p, 1.24std) 1.00x invariant, 0.0ms (0.05d, 0.93p, 0.04std) 0.99x slower X, 4.32μs (1.34d, 0.03p, 3.18std)
WGLMakie 3.64s (3.60, 3.68) 0.02+- 317.85ms (316.63, 319.20) 0.81+- 8.80s (8.66, 9.00) 0.12+- 9.00ms (8.90, 9.13) 0.10+- 73.54ms (66.79, 79.40) 4.92+-
master 3.62s (3.60, 3.64) 0.02+- 320.17ms (317.15, 323.16) 2.27+- 8.77s (8.72, 8.86) 0.05+- 9.26ms (8.87, 10.78) 0.68+- 72.68ms (67.29, 80.34) 4.79+-
evaluation 0.99x invariant, 0.02s (0.92d, 0.12p, 0.02std) 1.01x faster ✓, -2.33ms (-1.36d, 0.04p, 1.54std) 1.00x invariant, 0.03s (0.34d, 0.54p, 0.08std) 1.03x invariant, -0.26ms (-0.53d, 0.36p, 0.39std) 0.99x invariant, 0.86ms (0.18d, 0.74p, 4.86std)

MakieBot avatar Jan 14 '24 13:01 MakieBot