Skip to content

Cursor's Z coordinate display for NonUniformImage is inconsistent with image #18652

Closed
@eldond

Description

@eldond

Bug report

Bug summary

When using matplotlib.image.NonUniformImage, the coordinates of the cursor are wrong: the Z-coordinate is inconsistent with the image (it appears to be based on how imshow would display the data (flipped in Y)).
The Z values also don't change at the visible boundaries between "pixels" or cells, they change somewhere else that might be consistent with different cell alignment to the x,y values.

Code for reproduction

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

ax = plt.gca()

x = np.arange(201)
y = np.arange(201)
z = x[:, np.newaxis] + y[np.newaxis, :]
obj = matplotlib.image.NonUniformImage(ax=ax)
obj.set_data(x, y, z)
ax.add_image(obj)
ax.set_xlim(x.min(), x.max())
ax.set_ylim(y.min(), y.max())

plt.show()

Actual outcome

Notice that when the cursor is at the top right (value should approach 400), the value is about 200. When the cursor is at the bottom right (value should be about 200), the value approaches 400.
image
image

Expected outcome

It should be like the actual outcome, but with the correct Z-coordinates reported: should be close to 400 at the top right and close to 200 at the bottom right.

Matplotlib version

  • Operating system: Fedora 32
  • Matplotlib version: 3.1.2 (installed via pip)
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg, TkAgg
  • Python version: 3.8.5
  • numpy version: 1.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueOpen a pull request against these issues if there are no active ones!keepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions