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

Skip to content

Commit b5fac22

Browse files
committed
Minor docstring updates on thumbnail
1 parent 3fb64a5 commit b5fac22

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

lib/matplotlib/image.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,11 +1419,20 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
14191419

14201420

14211421
def pil_to_array(pilImage):
1422-
"""Load a PIL image and return it as a numpy array.
1422+
"""Load a `PIL image`_ and return it as a numpy array.
1423+
1424+
.. _PIL image: https://pillow.readthedocs.io/en/latest/reference/Image.html
1425+
1426+
Returns
1427+
-------
1428+
numpy.array
1429+
1430+
The array shape depends on the image type:
1431+
1432+
- (M, N) for grayscale images.
1433+
- (M, N, 3) for RGB images.
1434+
- (M, N, 4) for RGBA images.
14231435
1424-
Grayscale images are returned as ``(M, N)`` arrays. RGB images are
1425-
returned as ``(M, N, 3)`` arrays. RGBA images are returned as ``(M, N,
1426-
4)`` arrays.
14271436
"""
14281437
if pilImage.mode in ['RGBA', 'RGBX', 'RGB', 'L']:
14291438
# return MxNx4 RGBA, MxNx3 RBA, or MxN luminance array
@@ -1453,20 +1462,21 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
14531462
14541463
Parameters
14551464
----------
1456-
infile
1465+
infile : str or file-like
14571466
The image file -- must be PNG, Pillow-readable if you have `Pillow
14581467
<http://python-pillow.org/>`_ installed.
14591468
1460-
thumbfile
1469+
thumbfile : str or file-like
14611470
The thumbnail filename.
14621471
1463-
scale
1472+
scale : float, optional
14641473
The scale factor for the thumbnail.
14651474
1466-
interpolation
1467-
The interpolation scheme used in the resampling.
1475+
interpolation : str, optional
1476+
The interpolation scheme used in the resampling. See the
1477+
*interpolation* parameter of `~.Axes.imshow` for possible values.
14681478
1469-
preview
1479+
preview : bool, optional
14701480
If True, the default backend (presumably a user interface
14711481
backend) will be used which will cause a figure to be raised if
14721482
`~matplotlib.pyplot.show` is called. If it is False, the figure is
@@ -1475,7 +1485,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
14751485
14761486
Returns
14771487
-------
1478-
figure :
1488+
figure : `~.figure.Figure`
14791489
The figure instance containing the thumbnail.
14801490
"""
14811491

0 commit comments

Comments
 (0)