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

Skip to content

Commit c1c73bd

Browse files
dstansbyMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #15562: Improve docsting of AxesImage
1 parent 088fdfc commit c1c73bd

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

lib/matplotlib/image.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def _rgb_to_rgba(A):
219219

220220
class _ImageBase(martist.Artist, cm.ScalarMappable):
221221
"""
222+
Base class for images.
223+
222224
interpolation and cmap default to their rc settings
223225
224226
cmap is a colors.Colormap instance
@@ -229,7 +231,6 @@ class _ImageBase(martist.Artist, cm.ScalarMappable):
229231
centers with the zero-based row and column indices.
230232
231233
Additional kwargs are matplotlib.artist properties
232-
233234
"""
234235
zorder = 0
235236

@@ -266,7 +267,7 @@ def __getstate__(self):
266267
return state
267268

268269
def get_size(self):
269-
"""Get the numrows, numcols of the input image"""
270+
"""Return the size of the image as tuple (numrows, numcols)."""
270271
if self._A is None:
271272
raise RuntimeError('You must first set the image array')
272273

@@ -832,44 +833,42 @@ class AxesImage(_ImageBase):
832833
"""
833834
Parameters
834835
----------
835-
cmap : colors.Colormap
836+
ax : `~.axes.Axes`
837+
The axes the image will belong to.
838+
cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
836839
The Colormap instance or registered colormap name used to map scalar
837840
data to colors.
838-
norm : colors.Normalize
841+
norm : `~matplotlib.colors.Normalize`
839842
Maps luminance to 0-1.
840-
interpolation : str
843+
interpolation : str, default: :rc:`image.interpolation`
841844
Supported values are 'none', 'antialiased', 'nearest', 'bilinear',
842845
'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
843846
'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
844847
'sinc', 'lanczos'.
845-
origin : {'upper', 'lower'}
848+
origin : {'upper', 'lower'}, default: :rc:`image.origin`
846849
Place the [0, 0] index of the array in the upper left or lower left
847850
corner of the axes. The convention 'upper' is typically used for
848851
matrices and images.
849-
extent : tuple
852+
extent : tuple, optional
850853
The data axes (left, right, bottom, top) for making image plots
851854
registered with data plots. Default is to label the pixel
852855
centers with the zero-based row and column indices.
853-
filternorm : bool
856+
filternorm : bool, default: True
854857
A parameter for the antigrain image resize filter
855858
(see the antigrain documentation).
856859
If filternorm is set, the filter normalizes integer values and corrects
857860
the rounding errors. It doesn't do anything with the source floating
858861
point values, it corrects only integers according to the rule of 1.0
859862
which means that any sum of pixel weights must be equal to 1.0. So,
860863
the filter function must produce a graph of the proper shape.
861-
filterrad : float > 0
864+
filterrad : float > 0, default: 4
862865
The filter radius for filters that have a radius parameter, i.e. when
863866
interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
864-
resample : bool
867+
resample : bool, default: False
865868
When True, use a full resampling method. When False, only resample when
866869
the output image is larger than the input image.
867-
**kwargs
868-
Additional kwargs are matplotlib.artist properties.
870+
**kwargs : `.Artist` properties
869871
870-
Notes
871-
-----
872-
interpolation and cmap default to their rc settings
873872
"""
874873
def __str__(self):
875874
return "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds)
@@ -936,9 +935,9 @@ def set_extent(self, extent):
936935
937936
Notes
938937
-----
939-
This updates ``ax.dataLim`, and, if autoscaling, sets ``ax.viewLim``
938+
This updates ``ax.dataLim``, and, if autoscaling, sets ``ax.viewLim``
940939
to tightly fit the image, regardless of ``dataLim``. Autoscaling
941-
state is not changed, so following this with ax.autoscale_view
940+
state is not changed, so following this with ``ax.autoscale_view()``
942941
will redo the autoscaling in accord with ``dataLim``.
943942
"""
944943
self._extent = xmin, xmax, ymin, ymax = extent

0 commit comments

Comments
 (0)