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

Skip to content

Commit f7fa86a

Browse files
authored
Merge pull request #15562 from timhoffm/doc-axesimage
Improve docsting of AxesImage
2 parents 4f7f2e9 + 94b2cdd commit f7fa86a

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
@@ -217,6 +217,8 @@ def _rgb_to_rgba(A):
217217

218218
class _ImageBase(martist.Artist, cm.ScalarMappable):
219219
"""
220+
Base class for images.
221+
220222
interpolation and cmap default to their rc settings
221223
222224
cmap is a colors.Colormap instance
@@ -227,7 +229,6 @@ class _ImageBase(martist.Artist, cm.ScalarMappable):
227229
centers with the zero-based row and column indices.
228230
229231
Additional kwargs are matplotlib.artist properties
230-
231232
"""
232233
zorder = 0
233234

@@ -264,7 +265,7 @@ def __getstate__(self):
264265
return state
265266

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

@@ -823,44 +824,42 @@ class AxesImage(_ImageBase):
823824
"""
824825
Parameters
825826
----------
826-
cmap : colors.Colormap
827+
ax : `~.axes.Axes`
828+
The axes the image will belong to.
829+
cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
827830
The Colormap instance or registered colormap name used to map scalar
828831
data to colors.
829-
norm : colors.Normalize
832+
norm : `~matplotlib.colors.Normalize`
830833
Maps luminance to 0-1.
831-
interpolation : str
834+
interpolation : str, default: :rc:`image.interpolation`
832835
Supported values are 'none', 'antialiased', 'nearest', 'bilinear',
833836
'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
834837
'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
835838
'sinc', 'lanczos'.
836-
origin : {'upper', 'lower'}
839+
origin : {'upper', 'lower'}, default: :rc:`image.origin`
837840
Place the [0, 0] index of the array in the upper left or lower left
838841
corner of the axes. The convention 'upper' is typically used for
839842
matrices and images.
840-
extent : tuple
843+
extent : tuple, optional
841844
The data axes (left, right, bottom, top) for making image plots
842845
registered with data plots. Default is to label the pixel
843846
centers with the zero-based row and column indices.
844-
filternorm : bool
847+
filternorm : bool, default: True
845848
A parameter for the antigrain image resize filter
846849
(see the antigrain documentation).
847850
If filternorm is set, the filter normalizes integer values and corrects
848851
the rounding errors. It doesn't do anything with the source floating
849852
point values, it corrects only integers according to the rule of 1.0
850853
which means that any sum of pixel weights must be equal to 1.0. So,
851854
the filter function must produce a graph of the proper shape.
852-
filterrad : float > 0
855+
filterrad : float > 0, default: 4
853856
The filter radius for filters that have a radius parameter, i.e. when
854857
interpolation is one of: 'sinc', 'lanczos' or 'blackman'.
855-
resample : bool
858+
resample : bool, default: False
856859
When True, use a full resampling method. When False, only resample when
857860
the output image is larger than the input image.
858-
**kwargs
859-
Additional kwargs are matplotlib.artist properties.
861+
**kwargs : `.Artist` properties
860862
861-
Notes
862-
-----
863-
interpolation and cmap default to their rc settings
864863
"""
865864
def __str__(self):
866865
return "AxesImage(%g,%g;%gx%g)" % tuple(self.axes.bbox.bounds)
@@ -927,9 +926,9 @@ def set_extent(self, extent):
927926
928927
Notes
929928
-----
930-
This updates ``ax.dataLim`, and, if autoscaling, sets ``ax.viewLim``
929+
This updates ``ax.dataLim``, and, if autoscaling, sets ``ax.viewLim``
931930
to tightly fit the image, regardless of ``dataLim``. Autoscaling
932-
state is not changed, so following this with ax.autoscale_view
931+
state is not changed, so following this with ``ax.autoscale_view()``
933932
will redo the autoscaling in accord with ``dataLim``.
934933
"""
935934
self._extent = xmin, xmax, ymin, ymax = extent

0 commit comments

Comments
 (0)