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 CairoMakie erroring when recipes return lists of PlotSpec #3612

Closed
wants to merge 4 commits into from

Conversation

asinghvi17
Copy link
Member

Description

CairoMakie suffered from a method ambiguity when a convert_arguments returned a list of plotspecs using the new SpecApi. This PR eliminates that method ambiguity and adds a reference test for it, so we know that all backends support plotlists!

I will probably need some help updating the reference images though!

Type of change

Delete options that do not apply:

  • 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.

@asinghvi17 asinghvi17 added bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo. labels Feb 7, 2024
@asinghvi17 asinghvi17 self-assigned this Feb 7, 2024
@MakieBot
Copy link
Collaborator

MakieBot commented Feb 7, 2024

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.38s (3.34, 3.42) 0.03+- 383.30ms (376.53, 411.47) 12.82+- 476.92ms (462.10, 512.97) 21.19+- 7.21ms (6.99, 7.45) 0.15+- 25.37ms (25.26, 25.50) 0.11+-
master 3.37s (3.32, 3.43) 0.04+- 388.63ms (375.25, 397.52) 8.36+- 469.19ms (464.26, 474.68) 3.84+- 7.17ms (7.03, 7.29) 0.10+- 25.38ms (25.22, 25.54) 0.11+-
evaluation 1.00x invariant, 0.0s (0.09d, 0.87p, 0.04std) 1.01x invariant, -5.32ms (-0.49d, 0.38p, 10.59std) 0.98x invariant, 7.73ms (0.51d, 0.38p, 12.51std) 0.99x invariant, 0.05ms (0.38d, 0.50p, 0.13std) 1.00x invariant, -0.01ms (-0.09d, 0.87p, 0.11std)
CairoMakie 3.02s (2.99, 3.05) 0.02+- 318.95ms (316.90, 321.52) 1.76+- 140.74ms (139.39, 141.40) 0.66+- 7.16ms (7.09, 7.21) 0.04+- 604.91μs (598.23, 615.66) 7.02+-
master 3.03s (2.96, 3.14) 0.07+- 319.00ms (314.59, 322.21) 2.47+- 141.33ms (139.76, 144.04) 1.45+- 7.17ms (7.08, 7.28) 0.07+- 606.17μs (602.15, 609.42) 2.46+-
evaluation 1.01x invariant, -0.02s (-0.31d, 0.58p, 0.04std) 1.00x invariant, -0.04ms (-0.02d, 0.97p, 2.12std) 1.00x invariant, -0.59ms (-0.53d, 0.35p, 1.06std) 1.00x invariant, -0.01ms (-0.13d, 0.81p, 0.06std) 1.00x invariant, -1.25μs (-0.24d, 0.67p, 4.74std)
WGLMakie 3.75s (3.67, 3.82) 0.07+- 333.36ms (318.98, 369.55) 18.22+- 9.20s (8.89, 9.83) 0.35+- 10.05ms (9.29, 12.57) 1.13+- 70.94ms (68.11, 83.09) 5.43+-
master 3.74s (3.67, 3.80) 0.05+- 328.30ms (318.60, 336.90) 7.80+- 9.06s (8.97, 9.21) 0.10+- 9.50ms (9.25, 9.76) 0.18+- 73.73ms (68.51, 78.29) 3.80+-
evaluation 1.00x invariant, 0.02s (0.26d, 0.63p, 0.06std) 0.98x invariant, 5.05ms (0.36d, 0.52p, 13.01std) 0.98x invariant, 0.14s (0.54d, 0.35p, 0.22std) 0.95x noisy🤷‍♀️, 0.55ms (0.68d, 0.25p, 0.65std) 1.04x invariant, -2.79ms (-0.60d, 0.29p, 4.61std)

@asinghvi17
Copy link
Member Author

Hey, just want to bump this - would be nice to get it out there!

@SimonDanisch
Copy link
Member

On master the test case you added works for me.
Which Julia version did you try?
Also, the test case should be more like:

struct PlotlistTestType end

function Makie.convert_arguments(::Type{<: Makie.Plot}, obj::PlotlistTestType)
    return [
        Makie.SpecApi.Lines([0, 1], [0, 1]),
        Makie.SpecApi.Scatter([0.5], [0.5]),
    ]
end
plot(PlotlistTestType())

Or was there a good reason to define convert_arguments for Lines?

@asinghvi17
Copy link
Member Author

Huh! Yeah I just tested with latest master and this was not an issue there...maybe my local env was misconfigured? Will add the test you suggested at a later point.

About the lines thing: my usecase was specifically allowing plots to "pass-through", so lines seemed like the best candidate just to make sure nothing got in the way there.

@asinghvi17 asinghvi17 closed this Feb 16, 2024
@asinghvi17 asinghvi17 deleted the as/cairomakie_plotlist branch February 16, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CairoMakie This relates to CairoMakie, the vector backend for Makie based on Cairo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants