Skip to content

Commit dc4eabb

Browse files
committed
Fix NumPy FutureWarning: Format strings passed to MaskedConstant are ignored [...] when displaying masked pixel coordinates
(cherry picked from commit 73eb66d)
1 parent eb8789e commit dc4eabb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plotpy/items/image/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ def get_coordinates_label(self, x: float, y: float) -> str:
398398
"""
399399
title = self.title().text()
400400
z = self.get_data(x, y)
401-
return f"{title}:<br>x = {int(x):d}<br>y = {int(y):d}<br>z = {z:g}"
401+
zstr = "--" if z is np.ma.masked else f"{z:g}"
402+
return f"{title}:<br>x = {int(x):d}<br>y = {int(y):d}<br>z = {zstr}"
402403

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

0 commit comments

Comments
 (0)