Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9be828 commit 2b02440Copy full SHA for 2b02440
lib/matplotlib/tests/test_image.py
@@ -1103,3 +1103,18 @@ def test_respects_bbox():
1103
buf_after = io.BytesIO()
1104
fig.savefig(buf_after, format="rgba")
1105
assert buf_before.getvalue() != buf_after.getvalue() # Not all white.
1106
+
1107
1108
+def test_image_cursor_formatting():
1109
+ fig, ax = plt.subplots()
1110
+ # Create a dummy image to be able to call format_cursor_data
1111
+ im = ax.imshow(np.zeros((4, 4)))
1112
1113
+ data = np.ma.masked_array([0], mask=[True])
1114
+ assert im.format_cursor_data(data) == '[]'
1115
1116
+ data = np.ma.masked_array([0], mask=[False])
1117
+ assert im.format_cursor_data(data) == '[0]'
1118
1119
+ data = np.nan
1120
+ assert im.format_cursor_data(data) == '[nan]'
0 commit comments