Skip to content

Commit

Permalink
DOC: Improve NonUniformImage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
timhoffm committed Dec 21, 2024
1 parent 677d990 commit c6baa0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
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` or `pyplot` to create a
NonUniformImage. Instead, you have to instantiate the image explicitly and
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 @@ -808,7 +808,7 @@ def get_filterrad(self):

class AxesImage(_ImageBase):
"""
An image attached to an Axes.
An image, i.e. data on a regular grid, attached to an Axes.
Parameters
----------
Expand Down Expand Up @@ -995,6 +995,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

0 comments on commit c6baa0b

Please sign in to comment.