Skip to content

Commit

Permalink
naninspector (#4371)
Browse files Browse the repository at this point in the history
* show data inspector on NaN if nan_color is set

* clean up

* Update inspector.jl

---------

Co-authored-by: Ben Arthur <bjarthur70@gmail.com>
  • Loading branch information
SimonDanisch and bjarthur authored Sep 16, 2024
1 parent c463049 commit 90b219a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Show DataInspector tooltip on NaN values if `nan_color` has been set to other than `:transparent` [#4310](https://github.com/MakieOrg/Makie.jl/pull/4310)

## [0.21.11] - 2024-09-13

- Hot fixes for 0.21.10 [#4356](https://github.com/MakieOrg/Makie.jl/pull/4356).
Expand Down
9 changes: 3 additions & 6 deletions src/interaction/inspector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ function show_imagelike(inspector, plot, name, edge_based)
end

# in case we hover over NaN values
if isnan(z)
if isnan(z) && alpha(to_color(to_value(plot.nan_color))) <= 0.0
a.indicator_visible[] = false
tt.visible[] = false
return true
Expand All @@ -677,11 +677,8 @@ function show_imagelike(inspector, plot, name, edge_based)
tt.text[] = plot[:inspector_label][](plot, (i, j), ins_p)
end

a._color[] = if z isa AbstractFloat
interpolated_getindex(
to_colormap(plot.colormap[]), z,
extract_colorrange(plot)
)
a._color[] = if z isa Real
get(plot.calculated_colors[], z)
else
z
end
Expand Down

0 comments on commit 90b219a

Please sign in to comment.