Makie.jl
Makie.jl copied to clipboard
DataInspector callback attributes
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 typeindex
may also be a pair of indices (heatmap, image) andposition
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. replacesshow_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