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

DataInspector callback attributes #2261

Closed
wants to merge 25 commits into from

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Sep 9, 2022

Description

This adds a lookup for callback attributes in DataInspector. Specifically:

  • inspector_label = (plot, index, position) -> label which should return a string to be displayed when hovering a plot. Depending on the plot type index may also be a pair of indices (heatmap, image) and position can be a Point, bounding box (mesh) or pair of points (arrows).
  • inspector_hover = (inspector, plot, index[, source_plot]) -> ... which takes over the full tooltip setup, i.e. replaces show_data
  • inspector_clear = (inspector, plot) -> ... which triggers when no plot is hovered and can be used for extra cleanup

None of these need to be implemented. They change, replace or extend default behavior.

Closes #1759, #1902. For example:

fig = Figure()
ax = Axis(fig[1, 1])
scatter!(ax, rand(10), inspector_label = (self, i, p) -> "$p")
lines!(ax, rand(10), inspector_label = (self, i, p) -> "$p")
DataInspector(fig)
fig

This is branched off of #2095, so that should be merged first.

Type of change

  • 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.
  • Check that this doesn't break with CairoMakie and WGLMakie

ffreyer and others added 25 commits September 9, 2022 14:52
Warn when pasting fails
Check all characters are allowed before pasting, otherwise abort.
* Loosen type restriction

* Define relocatable path for use in `loadshader()`

* Use relocatable path instead of `@__DIR__`

* Update GLMakie/src/GLMakie.jl

Co-authored-by: Fabian Greimel <fabgrei@gmail.com>

Co-authored-by: Simon <sdanisch@protonmail.com>
Co-authored-by: Fabian Greimel <fabgrei@gmail.com>
* initial attempt of tricontourf

* use miniqhull instead

* use modified implementation of getting contours

* add docs page

* colormap example

* add colorbar to docs

* add visual tests

* add compat bounds

* use static rng

* add option to pass matrix of triangles instead

* shift to separate file

* add triangulation example

* add same example to tests

* add news

* fix missing contours

* type plot function correctly for method errors

* add CairoMakie tricontourf override

* map(Point2f

* factor out shared code between contourf and tricontourf

Co-authored-by: Simon <sdanisch@protonmail.com>
* fix changing input types

* add test
* Add makie latex string note

* Update latex.md

* Update latex.md

* Fix link

* Fix link description

* latex Works now...?

* Update latex.md

* Update latex.md
* Added recipe with docs for hexbin

* News entry

* remove axis dependent logic

* run formatter

* always plot poly

* clean up logic a bit

* switch to polygon scatter

* try changing to simpler algorithm

* scale hexagons correctly

* fix alg

* add binsize, not quite right yet

* remove nearestneighbors

* fix docs

* give up and use dict

* fix offset

* add docs

* add airport example

* add tests and highclip lowclip

* change meaning of bins and cellsize to more intuitive measures

* remove unused comments

* remove highclip/lowclip for now

* add zero threshold docs

* tighten limits in example

* ensure ints for isodd compat pre julia 1.7

* Update src/stats/hexbin.jl

Co-authored-by: Simon <sdanisch@protonmail.com>

* remove old comment

Co-authored-by: Tabea Wilke <twilke@oflks561.dwd.de>
Co-authored-by: twilke <t@w.de>
Co-authored-by: Simon <sdanisch@protonmail.com>
* better perf + fix clicks on items

* fix menu behaviour

* clean up and comment

* clean up and reference test

* fix tests

* don't make background black
@ffreyer ffreyer changed the base branch from master to ff/Tooltip October 8, 2022 12:19
ffreyer added a commit that referenced this pull request Oct 8, 2022
Changes:
- add `inspector_hover` attribute to allow replacing `show_data` on a per-plot basis
- add `inspector_label` attribute to allows for per-plot labels
- add `inspector_clear` attribute to allow for custom cleanup code (e.g. for an indicator visualization)
- adjust backends to ignore those attributes for rendering
- minor cleanup in `pick_sorted`
@ffreyer ffreyer closed this Oct 8, 2022
@ffreyer ffreyer mentioned this pull request Oct 8, 2022
12 tasks
@ffreyer ffreyer deleted the ff/inspector_callbacks branch October 10, 2022 06:33
SimonDanisch added a commit that referenced this pull request Oct 12, 2022
* add Tooltip recipe

* use Tooltip in DataInspector

* cleanup & restore useful indicators

* fix typo

Co-authored-by: Anshul Singhvi <asinghvi17@simons-rock.edu>

* fix tooltip alignment

* allow disabling of indicators

* cleanup

* update news

* add docs

* add test

* adjust tooltip args and fix indicator duplication

* fix indicator visibility & improve show_poly

* fix docs?

* fix error

* split news entry [skip ci]

* remove reused observables

* add align attribute

* fix typo

* start tooltip invisible

* manually merge #2261 (DataInspector callback attributes)

Changes:
- add `inspector_hover` attribute to allow replacing `show_data` on a per-plot basis
- add `inspector_label` attribute to allows for per-plot labels
- add `inspector_clear` attribute to allow for custom cleanup code (e.g. for an indicator visualization)
- adjust backends to ignore those attributes for rendering
- minor cleanup in `pick_sorted`

* update docs

* update NEWS

Co-authored-by: Anshul Singhvi <asinghvi17@simons-rock.edu>
Co-authored-by: Simon <sdanisch@protonmail.com>
t-bltg pushed a commit to t-bltg/Makie.jl that referenced this pull request Dec 31, 2022
* add Tooltip recipe

* use Tooltip in DataInspector

* cleanup & restore useful indicators

* fix typo

Co-authored-by: Anshul Singhvi <asinghvi17@simons-rock.edu>

* fix tooltip alignment

* allow disabling of indicators

* cleanup

* update news

* add docs

* add test

* adjust tooltip args and fix indicator duplication

* fix indicator visibility & improve show_poly

* fix docs?

* fix error

* split news entry [skip ci]

* remove reused observables

* add align attribute

* fix typo

* start tooltip invisible

* manually merge MakieOrg#2261 (DataInspector callback attributes)

Changes:
- add `inspector_hover` attribute to allow replacing `show_data` on a per-plot basis
- add `inspector_label` attribute to allows for per-plot labels
- add `inspector_clear` attribute to allow for custom cleanup code (e.g. for an indicator visualization)
- adjust backends to ignore those attributes for rendering
- minor cleanup in `pick_sorted`

* update docs

* update NEWS

Co-authored-by: Anshul Singhvi <asinghvi17@simons-rock.edu>
Co-authored-by: Simon <sdanisch@protonmail.com>
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.

Inspector + line label
5 participants