You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.3). For the latest version see <ahref="https://matplotlib.org/stable/api/image_api.html">https://matplotlib.org/stable/api/image_api.html</a></div>
<spanid="matplotlib-image"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.image</span></code><aclass="headerlink" href="#module-matplotlib.image" title="Permalink to this headline">¶</a></h1>
<p>The image module supports basic image loading, rescaling and display
operations.</p>
<dlclass="py class">
<dtid="matplotlib.image.AxesImage">
<emclass="property">class </em><codeclass="descclassname">matplotlib.image.</code><codeclass="descname">AxesImage</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="n">cmap</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">norm</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">interpolation</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">origin</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">extent</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">filternorm</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <em><spanclass="n">filterrad</span><spanclass="o">=</span><spanclass="default_value">4.0</span></em>, <em><spanclass="n">resample</span><spanclass="o">=</span><spanclass="default_value">False</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage" title="Permalink to this definition">¶</a></dt>
<dt><strong>origin</strong><spanclass="classifier">{'upper', 'lower'}, default: <codeclass="docutils literal notranslate"><aclass="reference external" href="../tutorials/introductory/customizing.html?highlight=image.origin#a-sample-matplotlibrc-file"><spanclass="pre">rcParams["image.origin"]</span></a></code> (default: <codeclass="docutils literal notranslate"><spanclass="pre">'upper'</span></code>)</span></dt><dd><p>Place the [0, 0] index of the array in the upper left or lower left
corner of the axes. The convention 'upper' is typically used for
matrices and images.</p>
</dd>
<dt><strong>extent</strong><spanclass="classifier">tuple, optional</span></dt><dd><p>The data axes (left, right, bottom, top) for making image plots
registered with data plots. Default is to label the pixel
centers with the zero-based row and column indices.</p>
</dd>
<dt><strong>filternorm</strong><spanclass="classifier">bool, default: True</span></dt><dd><p>A parameter for the antigrain image resize filter
(see the antigrain documentation).
If filternorm is set, the filter normalizes integer values and corrects
the rounding errors. It doesn't do anything with the source floating
point values, it corrects only integers according to the rule of 1.0
which means that any sum of pixel weights must be equal to 1.0. So,
the filter function must produce a graph of the proper shape.</p>
</dd>
<dt><strong>filterrad</strong><spanclass="classifier">float > 0, default: 4</span></dt><dd><p>The filter radius for filters that have a radius parameter, i.e. when
interpolation is one of: 'sinc', 'lanczos' or 'blackman'.</p>
</dd>
<dt><strong>resample</strong><spanclass="classifier">bool, default: False</span></dt><dd><p>When True, use a full resampling method. When False, only resample when
the output image is larger than the input image.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>norm</strong><spanclass="classifier"><aclass="reference internal" href="_as_gen/matplotlib.colors.Normalize.html#matplotlib.colors.Normalize" title="matplotlib.colors.Normalize"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.colors.Normalize</span></code></a> (or subclass thereof)</span></dt><dd><p>The normalizing object which scales data, typically into the
If <em>None</em>, <em>norm</em> defaults to a <em>colors.Normalize</em> object which
initializes its scaling based on the first data processed.</p>
</dd>
<dt><strong>cmap</strong><spanclass="classifier">str or <aclass="reference internal" href="_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap" title="matplotlib.colors.Colormap"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Colormap</span></code></a></span></dt><dd><p>The colormap used to map normalized data values to RGBA colors.</p>
<codeclass="descname">format_cursor_data</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">data</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.format_cursor_data"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.format_cursor_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string representation of <em>data</em>.</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">This method is intended to be overridden by artist subclasses.
As an end-user of Matplotlib you will most likely not call this
method yourself.</p>
</div>
<p>The default implementation converts ints and floats and arrays of ints
and floats into a comma-separated string enclosed in square brackets.</p>
<codeclass="descname">get_cursor_data</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.get_cursor_data"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.get_cursor_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the image value at the event position or <em>None</em> if the event is
<codeclass="descname">get_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.get_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.get_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the image extent as tuple (left, right, bottom, top).</p>
<codeclass="descname">get_window_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.get_window_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.get_window_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the axes bounding box in display space.</p>
<p>The bounding box' width and height are nonnegative.</p>
<p>Subclasses should override for inclusion in the bounding box
"tight" calculation. Default is to return an empty bounding
box at 0, 0.</p>
<p>Be careful when using this function, the results will not update
if the artist window extent of the artist changes. The extent
can change due to any changes in the transform stack, such as
changing the axes limits, the figure size, or the canvas used
(as is done when saving a figure). This can lead to unexpected
behavior where interactive figures will look fine on the screen,
but will save incorrectly.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.AxesImage.make_image">
<codeclass="descname">make_image</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span></em>, <em><spanclass="n">magnification</span><spanclass="o">=</span><spanclass="default_value">1.0</span></em>, <em><spanclass="n">unsampled</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.make_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.make_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Normalize, rescale, and colormap this image's data for rendering using
<em>renderer</em>, with the given <em>magnification</em>.</p>
<p>If <em>unsampled</em> is True, the image will not be scaled, but an
appropriate affine transformation will be returned instead.</p>
<trclass="field-odd field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>image</strong><spanclass="classifier">(M, N, 4) uint8 array</span></dt><dd><p>The RGBA image, resampled unless <em>unsampled</em> is True.</p>
</dd>
<dt><strong>x, y</strong><spanclass="classifier">float</span></dt><dd><p>The upper left corner where the image should be drawn, in pixel
space.</p>
</dd>
<dt><strong>trans</strong><spanclass="classifier">Affine2D</span></dt><dd><p>The affine transformation from image to pixel space.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.AxesImage.set_extent">
<codeclass="descname">set_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">extent</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#AxesImage.set_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.AxesImage.set_extent" title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>extent</strong><spanclass="classifier">4-tuple of float</span></dt><dd><p>The position and size of the image as tuple
<codeclass="docutils literal notranslate"><spanclass="pre">(left,</span><spanclass="pre">right,</span><spanclass="pre">bottom,</span><spanclass="pre">top)</span></code> in data coordinates.</p>
<p>The Image class whose size is determined by the given bbox.</p>
<p>cmap is a colors.Colormap instance
norm is a colors.Normalize instance to map luminance to 0-1</p>
<p>kwargs are an optional list of Artist keyword args</p>
<dlclass="py method">
<dtid="matplotlib.image.BboxImage.contains">
<codeclass="descname">contains</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">mouseevent</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#BboxImage.contains"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.BboxImage.contains" title="Permalink to this definition">¶</a></dt>
<dd><p>Test whether the mouse event occurred within the image.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.BboxImage.get_transform">
<codeclass="descname">get_transform</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#BboxImage.get_transform"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.BboxImage.get_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the <aclass="reference internal" href="transformations.html#matplotlib.transforms.Transform" title="matplotlib.transforms.Transform"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Transform</span></code></a> instance used by this artist.</p>
<codeclass="descname">get_window_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#BboxImage.get_window_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.BboxImage.get_window_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the axes bounding box in display space.</p>
<p>The bounding box' width and height are nonnegative.</p>
<p>Subclasses should override for inclusion in the bounding box
"tight" calculation. Default is to return an empty bounding
box at 0, 0.</p>
<p>Be careful when using this function, the results will not update
if the artist window extent of the artist changes. The extent
can change due to any changes in the transform stack, such as
changing the axes limits, the figure size, or the canvas used
(as is done when saving a figure). This can lead to unexpected
behavior where interactive figures will look fine on the screen,
but will save incorrectly.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.BboxImage.make_image">
<codeclass="descname">make_image</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span></em>, <em><spanclass="n">magnification</span><spanclass="o">=</span><spanclass="default_value">1.0</span></em>, <em><spanclass="n">unsampled</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#BboxImage.make_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.BboxImage.make_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Normalize, rescale, and colormap this image's data for rendering using
<em>renderer</em>, with the given <em>magnification</em>.</p>
<p>If <em>unsampled</em> is True, the image will not be scaled, but an
appropriate affine transformation will be returned instead.</p>
norm is a colors.Normalize instance to map luminance to 0-1</p>
<p>kwargs are an optional list of Artist keyword args</p>
<dlclass="py method">
<dtid="matplotlib.image.FigureImage.get_extent">
<codeclass="descname">get_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#FigureImage.get_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.FigureImage.get_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the image extent as tuple (left, right, bottom, top).</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.FigureImage.make_image">
<codeclass="descname">make_image</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span></em>, <em><spanclass="n">magnification</span><spanclass="o">=</span><spanclass="default_value">1.0</span></em>, <em><spanclass="n">unsampled</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#FigureImage.make_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.FigureImage.make_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Normalize, rescale, and colormap this image's data for rendering using
<em>renderer</em>, with the given <em>magnification</em>.</p>
<p>If <em>unsampled</em> is True, the image will not be scaled, but an
appropriate affine transformation will be returned instead.</p>
<trclass="field-odd field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>image</strong><spanclass="classifier">(M, N, 4) uint8 array</span></dt><dd><p>The RGBA image, resampled unless <em>unsampled</em> is True.</p>
</dd>
<dt><strong>x, y</strong><spanclass="classifier">float</span></dt><dd><p>The upper left corner where the image should be drawn, in pixel
space.</p>
</dd>
<dt><strong>trans</strong><spanclass="classifier">Affine2D</span></dt><dd><p>The affine transformation from image to pixel space.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.FigureImage.set_data">
<codeclass="descname">set_data</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">A</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#FigureImage.set_data"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.FigureImage.set_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the image array.</p>
</dd></dl>
<dlclass="py attribute">
<dtid="matplotlib.image.FigureImage.zorder">
<codeclass="descname">zorder</code><emclass="property"> = 0</em><aclass="headerlink" href="#matplotlib.image.FigureImage.zorder" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.image.NonUniformImage">
<emclass="property">class </em><codeclass="descclassname">matplotlib.image.</code><codeclass="descname">NonUniformImage</code><spanclass="sig-paren">(</span><em><spanclass="n">ax</span></em>, <em><spanclass="o">*</span></em>, <em><spanclass="n">interpolation</span><spanclass="o">=</span><spanclass="default_value">'nearest'</span></em>, <em><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage" title="Permalink to this definition">¶</a></dt>
<dt><strong>**kwargs</strong></dt><dd><p>All other keyword arguments are identical to those of <aclass="reference internal" href="#matplotlib.image.AxesImage" title="matplotlib.image.AxesImage"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">AxesImage</span></code></a>.</p>
<codeclass="descname">get_extent</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.get_extent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.get_extent" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the image extent as tuple (left, right, bottom, top).</p>
<emclass="property">property </em><codeclass="descname">is_grayscale</code><aclass="headerlink" href="#matplotlib.image.NonUniformImage.is_grayscale" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_array</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="o">*</span><spanclass="n">args</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_array"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_array" title="Permalink to this definition">¶</a></dt>
<dd><p>Retained for backwards compatibility - use set_data instead.</p>
<codeclass="descname">set_cmap</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">cmap</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_cmap"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_cmap" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_filternorm</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">s</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_filternorm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_filternorm" title="Permalink to this definition">¶</a></dt>
<dd><p>Set whether the resize filter normalizes the weights.</p>
<p>See help for <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">imshow</span></code></a>.</p>
<codeclass="descname">set_filterrad</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">s</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_filterrad"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_filterrad" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the resize filter radius only applicable to some
<codeclass="descname">set_interpolation</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">s</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_interpolation"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_interpolation" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">set_norm</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">norm</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#NonUniformImage.set_norm"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.NonUniformImage.set_norm" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_cursor_data</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">event</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#PcolorImage.get_cursor_data"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.PcolorImage.get_cursor_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the image value at the event position or <em>None</em> if the event is
<emclass="property">property </em><codeclass="descname">is_grayscale</code><aclass="headerlink" href="#matplotlib.image.PcolorImage.is_grayscale" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.PcolorImage.make_image">
<codeclass="descname">make_image</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">renderer</span></em>, <em><spanclass="n">magnification</span><spanclass="o">=</span><spanclass="default_value">1.0</span></em>, <em><spanclass="n">unsampled</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#PcolorImage.make_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.PcolorImage.make_image" title="Permalink to this definition">¶</a></dt>
<dd><p>Normalize, rescale, and colormap this image's data for rendering using
<em>renderer</em>, with the given <em>magnification</em>.</p>
<p>If <em>unsampled</em> is True, the image will not be scaled, but an
appropriate affine transformation will be returned instead.</p>
<trclass="field-odd field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>image</strong><spanclass="classifier">(M, N, 4) uint8 array</span></dt><dd><p>The RGBA image, resampled unless <em>unsampled</em> is True.</p>
</dd>
<dt><strong>x, y</strong><spanclass="classifier">float</span></dt><dd><p>The upper left corner where the image should be drawn, in pixel
space.</p>
</dd>
<dt><strong>trans</strong><spanclass="classifier">Affine2D</span></dt><dd><p>The affine transformation from image to pixel space.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.image.PcolorImage.set_array">
<codeclass="descname">set_array</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="o">*</span><spanclass="n">args</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#PcolorImage.set_array"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.PcolorImage.set_array" title="Permalink to this definition">¶</a></dt>
<dd><p>Retained for backwards compatibility - use set_data instead.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>x, y</strong><spanclass="classifier">1D array-like, optional</span></dt><dd><p>Monotonic arrays of length N+1 and M+1, respectively, specifying
rectangle boundaries. If not given, will default to
<codeclass="docutils literal notranslate"><spanclass="pre">range(N</span><spanclass="pre">+</span><spanclass="pre">1)</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">range(M</span><spanclass="pre">+</span><spanclass="pre">1)</span></code>, respectively.</p>
</dd>
<dt><strong>A</strong><spanclass="classifier">array-like</span></dt><dd><p>The data to be color-coded. The interpretation depends on the
shape:</p>
<ulclass="simple">
<li>(M, N) ndarray or masked array: values to be colormapped</li>
<li>(M, N, 3): RGB array</li>
<li>(M, N, 4): RGBA array</li>
</ul>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.image.composite_images">
<codeclass="descclassname">matplotlib.image.</code><codeclass="descname">composite_images</code><spanclass="sig-paren">(</span><em><spanclass="n">images</span></em>, <em><spanclass="n">renderer</span></em>, <em><spanclass="n">magnification</span><spanclass="o">=</span><spanclass="default_value">1.0</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#composite_images"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.composite_images" title="Permalink to this definition">¶</a></dt>
<dd><p>Composite a number of RGBA images into one. The images are
composited in the order in which they appear in the <em>images</em> list.</p>
<dt><strong>images</strong><spanclass="classifier">list of Images</span></dt><dd><p>Each must have a <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">make_image</span></code> method. For each image,
<codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">can_composite</span></code> should return <aclass="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.9)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">True</span></code></a>, though this is not
enforced by this function. Each image must have a purely
<dt><strong>magnification</strong><spanclass="classifier">float, default: 1</span></dt><dd><p>The additional magnification to apply for the renderer in use.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>image</strong><spanclass="classifier">uint8 3d array</span></dt><dd><p>The composited RGBA image.</p>
</dd>
<dt><strong>offset_x, offset_y</strong><spanclass="classifier">float</span></dt><dd><p>The (left, bottom) offset where the composited image should be placed
in the output figure.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.image.imread">
<codeclass="descclassname">matplotlib.image.</code><codeclass="descname">imread</code><spanclass="sig-paren">(</span><em><spanclass="n">fname</span></em>, <em><spanclass="n">format</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#imread"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.imread" title="Permalink to this definition">¶</a></dt>
<dd><p>Read an image from a file into an array.</p>
<dt><strong>fname</strong><spanclass="classifier">str or file-like</span></dt><dd><p>The image file to read: a filename, a URL or a file-like object opened
in read-binary mode.</p>
</dd>
<dt><strong>format</strong><spanclass="classifier">str, optional</span></dt><dd><p>The image file format assumed for reading the data. If not
given, the format is deduced from the filename. If nothing can
be deduced, PNG is tried.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><aclass="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.array.html#numpy.array" title="(in NumPy v1.19)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">numpy.array</span></code></a></dt><dd><p>The image data. The returned array has shape</p>
<ulclass="simple">
<li>(M, N) for grayscale images.</li>
<li>(M, N, 3) for RGB images.</li>
<li>(M, N, 4) for RGBA images.</li>
</ul>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.image.imsave">
<codeclass="descclassname">matplotlib.image.</code><codeclass="descname">imsave</code><spanclass="sig-paren">(</span><em><spanclass="n">fname</span></em>, <em><spanclass="n">arr</span></em>, <em><spanclass="n">vmin</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">vmax</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">cmap</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">format</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">origin</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">dpi</span><spanclass="o">=</span><spanclass="default_value">100</span></em>, <em><spanclass="o">*</span></em>, <em><spanclass="n">metadata</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">pil_kwargs</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#imsave"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.imsave" title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>fname</strong><spanclass="classifier">str or path-like or file-like</span></dt><dd><p>A path or a file-like object to store the image in.
If <em>format</em> is not set, then the output format is inferred from the
extension of <em>fname</em>, if any, and from <codeclass="docutils literal notranslate"><aclass="reference external" href="../tutorials/introductory/customizing.html?highlight=savefig.format#a-sample-matplotlibrc-file"><spanclass="pre">rcParams["savefig.format"]</span></a></code> (default: <codeclass="docutils literal notranslate"><spanclass="pre">'png'</span></code>) otherwise.
If <em>format</em> is set, it determines the output format.</p>
</dd>
<dt><strong>arr</strong><spanclass="classifier">array-like</span></dt><dd><p>The image data. The shape can be one of
MxN (luminance), MxNx3 (RGB) or MxNx4 (RGBA).</p>
</dd>
<dt><strong>vmin, vmax</strong><spanclass="classifier">float, optional</span></dt><dd><p><em>vmin</em> and <em>vmax</em> set the color scaling for the image by fixing the
values that map to the colormap color limits. If either <em>vmin</em>
or <em>vmax</em> is None, that limit is determined from the <em>arr</em>
min/max value.</p>
</dd>
<dt><strong>cmap</strong><spanclass="classifier">str or <aclass="reference internal" href="_as_gen/matplotlib.colors.Colormap.html#matplotlib.colors.Colormap" title="matplotlib.colors.Colormap"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Colormap</span></code></a>, default: <codeclass="docutils literal notranslate"><aclass="reference external" href="../tutorials/introductory/customizing.html?highlight=image.cmap#a-sample-matplotlibrc-file"><spanclass="pre">rcParams["image.cmap"]</span></a></code> (default: <codeclass="docutils literal notranslate"><spanclass="pre">'viridis'</span></code>)</span></dt><dd><p>A Colormap instance or registered colormap name. The colormap
maps scalar data to colors. It is ignored for RGB(A) data.</p>
</dd>
<dt><strong>format</strong><spanclass="classifier">str, optional</span></dt><dd><p>The file format, e.g. 'png', 'pdf', 'svg', ... The behavior when this
is unset is documented under <em>fname</em>.</p>
</dd>
<dt><strong>origin</strong><spanclass="classifier">{'upper', 'lower'}, default: <codeclass="docutils literal notranslate"><aclass="reference external" href="../tutorials/introductory/customizing.html?highlight=image.origin#a-sample-matplotlibrc-file"><spanclass="pre">rcParams["image.origin"]</span></a></code> (default: <codeclass="docutils literal notranslate"><spanclass="pre">'upper'</span></code>)</span></dt><dd><p>Indicates whether the <codeclass="docutils literal notranslate"><spanclass="pre">(0,</span><spanclass="pre">0)</span></code> index of the array is in the upper
left or lower left corner of the axes.</p>
</dd>
<dt><strong>dpi</strong><spanclass="classifier">float</span></dt><dd><p>The DPI to store in the metadata of the file. This does not affect the
resolution of the output image. Depending on file format, this may be
rounded to the nearest integer.</p>
</dd>
<dt><strong>metadata</strong><spanclass="classifier">dict, optional</span></dt><dd><p>Metadata in the image file. The supported keys depend on the output
format, see the documentation of the respective backends for more
information.</p>
</dd>
<dt><strong>pil_kwargs</strong><spanclass="classifier">dict, optional</span></dt><dd><p>Keyword arguments passed to <aclass="reference external" href="https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save" title="(in Pillow (PIL Fork) v8.0.1)"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">PIL.Image.Image.save</span></code></a>. If the 'pnginfo'
key is present, it completely overrides <em>metadata</em>, including the
default 'Software' key.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="py function">
<dtid="matplotlib.image.pil_to_array">
<codeclass="descclassname">matplotlib.image.</code><codeclass="descname">pil_to_array</code><spanclass="sig-paren">(</span><em><spanclass="n">pilImage</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/image.html#pil_to_array"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.image.pil_to_array" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a <aclass="reference external" href="https://pillow.readthedocs.io/en/latest/reference/Image.html">PIL image</a> and return it as a numpy int array.</p>
<dt><strong>infile</strong><spanclass="classifier">str or file-like</span></dt><dd><p>The image file. Matplotlib relies on <aclass="reference external" href="https://python-pillow.org/">Pillow</a> for image reading, and
thus supports a wide range of file formats, including PNG, JPG, TIFF
and others.</p>
</dd>
<dt><strong>thumbfile</strong><spanclass="classifier">str or file-like</span></dt><dd><p>The thumbnail filename.</p>
</dd>
<dt><strong>scale</strong><spanclass="classifier">float, default: 0.1</span></dt><dd><p>The scale factor for the thumbnail.</p>
</dd>
<dt><strong>interpolation</strong><spanclass="classifier">str, default: 'bilinear'</span></dt><dd><p>The interpolation scheme used in the resampling. See the
<em>interpolation</em> parameter of <aclass="reference internal" href="_as_gen/matplotlib.axes.Axes.imshow.html#matplotlib.axes.Axes.imshow" title="matplotlib.axes.Axes.imshow"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">imshow</span></code></a> for possible values.</p>
</dd>
<dt><strong>preview</strong><spanclass="classifier">bool, default: False</span></dt><dd><p>If True, the default backend (presumably a user interface
backend) will be used which will cause a figure to be raised if
<aclass="reference internal" href="_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show" title="matplotlib.pyplot.show"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">show</span></code></a> is called. If it is False, the figure is
created using <aclass="reference internal" href="backend_bases_api.html#matplotlib.backend_bases.FigureCanvasBase" title="matplotlib.backend_bases.FigureCanvasBase"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FigureCanvasBase</span></code></a> and the drawing backend is selected
as <aclass="reference internal" href="_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.savefig" title="matplotlib.figure.Figure.savefig"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Figure.savefig</span></code></a> would normally do.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">