Skip to content

Backport PR #29370 on branch v3.10.x (DOC: Improve NonUniformImage docs) #29987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
Image nonuniform
================

This illustrates the NonUniformImage class. It is not
available via an Axes method, but it is easily added to an
Axes instance as shown here.
`.NonUniformImage` is a generalized image with pixels on a rectilinear grid,
i.e. it allows rows and columns with individual heights / widths.

There is no high-level plotting method on `~.axes.Axes` or `.pyplot` to
create a NonUniformImage. Instead, you have to instantiate the image
explicitly add it to the Axes using `.Axes.add_image`.
"""

import matplotlib.pyplot as plt
Expand Down
10 changes: 9 additions & 1 deletion lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ def get_filterrad(self):

class AxesImage(_ImageBase):
"""
An image attached to an Axes.
An image with pixels on a regular grid, attached to an Axes.

Parameters
----------
Expand Down Expand Up @@ -1005,6 +1005,14 @@ def get_cursor_data(self, event):


class NonUniformImage(AxesImage):
"""
An image with pixels on a rectilinear grid.

In contrast to `.AxesImage`, where pixels are on a regular grid,
NonUniformImage allows rows and columns with individual heights / widths.

See also :doc:`/gallery/images_contours_and_fields/image_nonuniform`.
"""

def __init__(self, ax, *, interpolation='nearest', **kwargs):
"""
Expand Down
Loading