Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AxesImage.__str__ is wrong if the image does not span the full Axes. #20294

Closed
@anntzer

Description

@anntzer

Bug report

Bug summary

AxesImage.__str__ is currently implemented as "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds), which means that the coordinates printed out are wrong whenever the image does not span the full Axes. (Well, technically we make no guarantees about the meaning of the str of the image but you'd expect that the numbers match the image's extents...

Code for reproduction

from pylab import *
im1 = imshow([[1, 2]]); im2 = imshow(np.arange(9).reshape((3, 3))); print(im1, im2)

Actual outcome

One image is much smaller than the other, but both are printed as

AxesImage(80,52.8;496x369.6) AxesImage(80,52.8;496x369.6)

Expected outcome

Either correct extents, or a different __str__ with less information.

Matplotlib version

  • Operating system: linux
  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4+HEAD
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 39
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions