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

[WIP] Improvements to PlotSpecs and the SpecAPI #3628

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

asinghvi17
Copy link
Member

Description

This is a WIP set of improvements/changes to the SpecAPI after some usage.

  • Forward PlotList attributes to plots at creation time (this doesn't allow post facto editing, but e.g. plot(diffeq_solution; linewidth = 0.1) will at least work).

More changes will come as I keep messing around with this stuff...

Type of change

Delete options that do not apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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 and others added 2 commits February 13, 2024 11:46
This doesn't allow post facto editing, but e.g. `plot(diffeq_solution; linewidth = 0.1)` will at least work.
@asinghvi17 asinghvi17 marked this pull request as draft February 13, 2024 16:55
@MakieBot
Copy link
Collaborator

MakieBot commented Feb 13, 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.53s (3.45, 3.72) 0.09+- 401.15ms (383.72, 435.31) 18.36+- 492.07ms (460.68, 560.38) 34.33+- 7.47ms (7.20, 8.16) 0.33+- 26.04ms (25.34, 26.59) 0.44+-
master 3.54s (3.47, 3.71) 0.08+- 404.18ms (386.71, 437.88) 17.73+- 473.18ms (465.22, 488.41) 8.26+- 7.50ms (7.33, 7.95) 0.21+- 25.75ms (25.34, 26.12) 0.30+-
evaluation 1.00x invariant, -0.01s (-0.09d, 0.86p, 0.09std) 1.01x invariant, -3.03ms (-0.17d, 0.76p, 18.04std) 0.96x invariant, 18.88ms (0.76d, 0.20p, 21.29std) 1.00x invariant, -0.03ms (-0.09d, 0.86p, 0.27std) 0.99x invariant, 0.29ms (0.76d, 0.18p, 0.37std)
CairoMakie 3.24s (3.16, 3.33) 0.06+- 336.20ms (327.18, 349.13) 7.60+- 147.82ms (142.35, 155.90) 4.32+- 7.76ms (7.50, 8.16) 0.21+- 615.81μs (606.67, 629.95) 8.09+-
master 3.23s (3.15, 3.33) 0.07+- 344.93ms (324.44, 367.68) 14.39+- 146.90ms (142.46, 154.18) 5.13+- 7.94ms (7.72, 8.19) 0.19+- 611.16μs (606.09, 617.49) 3.98+-
evaluation 1.00x invariant, 0.0s (0.07d, 0.90p, 0.06std) 1.03x invariant, -8.73ms (-0.76d, 0.19p, 10.99std) 0.99x invariant, 0.92ms (0.19d, 0.72p, 4.73std) 1.02x invariant, -0.18ms (-0.91d, 0.11p, 0.20std) 0.99x invariant, 4.64μs (0.73d, 0.21p, 6.03std)
WGLMakie 3.63s (3.61, 3.65) 0.01+- 317.32ms (313.30, 319.59) 2.07+- 8.80s (8.72, 8.96) 0.09+- 8.97ms (8.90, 9.01) 0.04+- 69.26ms (66.90, 74.25) 2.87+-
master 3.63s (3.62, 3.65) 0.01+- 319.04ms (314.27, 323.38) 3.25+- 8.78s (8.75, 8.83) 0.03+- 9.15ms (8.92, 10.13) 0.44+- 72.34ms (67.55, 81.15) 5.77+-
evaluation 1.00x invariant, 0.0s (0.13d, 0.82p, 0.01std) 1.01x invariant, -1.72ms (-0.63d, 0.26p, 2.66std) 1.00x invariant, 0.02s (0.32d, 0.57p, 0.06std) 1.02x invariant, -0.18ms (-0.58d, 0.32p, 0.24std) 1.04x invariant, -3.08ms (-0.68d, 0.24p, 4.32std)

@@ -401,6 +401,13 @@ function to_plot_object(ps::PlotSpec)
return P((ps.args...,), copy(ps.kwargs))
end

function to_plot_object(ps::PlotSpec, p::PlotList)
P = plottype(ps)
Copy link
Member Author

Choose a reason for hiding this comment

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

What would people think if, knowing the default_theme of P()::Plot here, we populate the missing attributes with their default values as Observables in p::PlotList, so that users can edit them post-facto and have them pass through like normal Observables?

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.

None yet

2 participants