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

Skip to content

Commit 0334c04

Browse files
authored
Merge pull request #11329 from timhoffm/doc-thumbnail
DOC: Minor docstring update of thumbnail
2 parents ad44a7e + b5fac22 commit 0334c04

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

lib/matplotlib/image.py

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

14321432

14331433
def pil_to_array(pilImage):
1434-
"""Load a PIL image and return it as a numpy array.
1434+
"""Load a `PIL image`_ and return it as a numpy array.
1435+
1436+
.. _PIL image: https://pillow.readthedocs.io/en/latest/reference/Image.html
1437+
1438+
Returns
1439+
-------
1440+
numpy.array
1441+
1442+
The array shape depends on the image type:
1443+
1444+
- (M, N) for grayscale images.
1445+
- (M, N, 3) for RGB images.
1446+
- (M, N, 4) for RGBA images.
14351447
1436-
Grayscale images are returned as ``(M, N)`` arrays. RGB images are
1437-
returned as ``(M, N, 3)`` arrays. RGBA images are returned as ``(M, N,
1438-
4)`` arrays.
14391448
"""
14401449
if pilImage.mode in ['RGBA', 'RGBX', 'RGB', 'L']:
14411450
# return MxNx4 RGBA, MxNx3 RBA, or MxN luminance array
@@ -1465,20 +1474,21 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
14651474
14661475
Parameters
14671476
----------
1468-
infile
1477+
infile : str or file-like
14691478
The image file -- must be PNG, Pillow-readable if you have `Pillow
14701479
<http://python-pillow.org/>`_ installed.
14711480
1472-
thumbfile
1481+
thumbfile : str or file-like
14731482
The thumbnail filename.
14741483
1475-
scale
1484+
scale : float, optional
14761485
The scale factor for the thumbnail.
14771486
1478-
interpolation
1479-
The interpolation scheme used in the resampling.
1487+
interpolation : str, optional
1488+
The interpolation scheme used in the resampling. See the
1489+
*interpolation* parameter of `~.Axes.imshow` for possible values.
14801490
1481-
preview
1491+
preview : bool, optional
14821492
If True, the default backend (presumably a user interface
14831493
backend) will be used which will cause a figure to be raised if
14841494
`~matplotlib.pyplot.show` is called. If it is False, the figure is
@@ -1487,7 +1497,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
14871497
14881498
Returns
14891499
-------
1490-
figure :
1500+
figure : `~.figure.Figure`
14911501
The figure instance containing the thumbnail.
14921502
"""
14931503

0 commit comments

Comments
 (0)