8000 [ENH]: Add `get_shape` as alias for `get_size` in AxesImage, or make that include depth too · Issue #22494 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[ENH]: Add get_shape as alias for get_size in AxesImage, or make that include depth too #22494
Closed
@anntzer

Description

@anntzer

Problem

#22485 changed AxesImage.__str__ to AxesImage(size=(nrows, ncols)). While this indeed corresponds to AxesImage.get_size, this is not consistent with the numpy API, where array.shape = (nrows, ncols) and array.size = nrows * ncols.
Perhaps we can consider 1) tweaking __str__ to AxesImage(shape=(nrows, ncols)) instead, and add get_shape as an alias for get_size? Alternatively, get_shape could return self._A.shape (i.e., including whether the data is colormapped, RGB, or RGBA), and we could use that info in __str__? (displaying whether the data is colormapped/RGB/RGBA seems reasonably useful)

Proposed solution

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0