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

add highlevel gui + auto legend/colorbar #3491

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

Conversation

SimonDanisch
Copy link
Member

@SimonDanisch SimonDanisch commented Dec 19, 2023

This is a proposal for an easy way to add a highlevel GUI and auto legend/colorbar, without any changes to the internal plotting pipeline.
This makes the implementation pretty straightforward and easy to change going forward, at the slight expanse of discoverability & usability.
This works by just wrapping a plot call into GUI(plot(...)), which will then create a GUI like this:
GUI
TODOs:

  • tests
  • more documentation
  • precompiles
  • finalize API
  • what should we do about mutating calls after the call to GUI?

@MakieBot
Copy link
Collaborator

MakieBot commented Dec 19, 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(fig)
using create display create display
GLMakie 3.68s (3.65, 3.76) 0.05+- 492.74ms (484.70, 497.20) 4.97+- 509.70ms (493.70, 555.47) 20.89+- 7.94ms (7.80, 8.02) 0.09+- 26.34ms (26.25, 26.49) 0.10+-
master 3.76s (3.69, 3.81) 0.04+- 431.59ms (409.06, 460.83) 16.02+- 515.49ms (497.74, 554.02) 20.49+- 7.93ms (7.71, 8.18) 0.19+- 26.37ms (26.26, 26.60) 0.13+-
evaluation 1.02x faster ✓, -0.08s (-1.83d, 0.01p, 0.04std) 0.88x slower❌, 61.15ms (5.16d, 0.00p, 10.49std) 1.01x invariant, -5.79ms (-0.28d, 0.61p, 20.69std) 1.00x invariant, 0.01ms (0.04d, 0.95p, 0.14std) 1.00x invariant, -0.03ms (-0.30d, 0.59p, 0.11std)
CairoMakie 3.13s (3.08, 3.16) 0.02+- 318.01ms (315.62, 324.04) 2.92+- 141.51ms (139.47, 145.15) 1.99+- 7.66ms (7.61, 7.74) 0.05+- 598.94μs (595.77, 600.34) 1.56+-
master 3.08s (3.06, 3.12) 0.02+- 324.32ms (317.07, 343.34) 9.65+- 144.36ms (140.88, 152.61) 4.00+- 7.73ms (7.66, 7.81) 0.06+- 601.96μs (594.92, 609.44) 5.62+-
evaluation 0.98x slower X, 0.05s (2.09d, 0.00p, 0.02std) 1.02x invariant, -6.31ms (-0.88d, 0.14p, 6.29std) 1.02x invariant, -2.85ms (-0.90d, 0.13p, 2.99std) 1.01x faster ✓, -0.07ms (-1.30d, 0.03p, 0.05std) 1.01x invariant, -3.02μs (-0.73d, 0.21p, 3.59std)
WGLMakie 3.89s (3.82, 3.93) 0.04+- 309.45ms (301.23, 314.19) 4.94+- 8.40s (8.35, 8.48) 0.05+- 8.98ms (8.75, 9.10) 0.11+- 69.51ms (66.83, 79.64) 4.64+-
master 3.70s (3.66, 3.74) 0.03+- 318.46ms (306.23, 328.05) 6.55+- 8.48s (8.40, 8.54) 0.05+- 9.00ms (8.81, 9.13) 0.13+- 69.53ms (66.90, 73.54) 2.59+-
evaluation 0.95x slower❌, 0.2s (5.58d, 0.00p, 0.04std) 1.03x faster ✓, -9.01ms (-1.55d, 0.01p, 5.74std) 1.01x faster ✓, -0.08s (-1.65d, 0.01p, 0.05std) 1.00x invariant, -0.02ms (-0.15d, 0.78p, 0.12std) 1.00x invariant, -0.02ms (-0.01d, 0.99p, 3.61std)

@t-bltg t-bltg added the gui All GUI related improvements label Dec 25, 2023
f, ax, pl = GUI(series(rand(7, 20)); legend=(position=:lt, title="legend"))
```
"""
function GUI(faxpl::Makie.FigureAxisPlot; legend=(;), colorbar=(;))
Copy link
Member

Choose a reason for hiding this comment

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

Could we also add a method which accepts a figure, so people can "opt-in" to displaying their figures (or maybe even Scenes) in this GUI by default, perhaps by setting a switch in activate!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui All GUI related improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants