Skip to content

Commit

Permalink
Fix NumPy `FutureWarning: Format strings passed to MaskedConstant are…
Browse files Browse the repository at this point in the history
… ignored [...]` when displaying masked pixel coordinates

(cherry picked from commit 73eb66d)
  • Loading branch information
PierreRaybaut committed Sep 4, 2024
1 parent eb8789e commit dc4eabb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plotpy/items/image/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ def get_coordinates_label(self, x: float, y: float) -> str:
"""
title = self.title().text()
z = self.get_data(x, y)
return f"{title}:<br>x = {int(x):d}<br>y = {int(y):d}<br>z = {z:g}"
zstr = "--" if z is np.ma.masked else f"{z:g}"
return f"{title}:<br>x = {int(x):d}<br>y = {int(y):d}<br>z = {zstr}"

def set_background_color(self, qcolor: QColor | str) -> None:
"""Set background color
Expand Down

0 comments on commit dc4eabb

Please sign in to comment.