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

Skip to content

Commit b097f85

Browse files
authored
Merge pull request #14070 from anntzer/pyplot-docstrings
DOC: Cleanup some pyplot docstrings.
2 parents 4507a59 + 413fd4f commit b097f85

File tree

1 file changed

+28
-33
lines changed

1 file changed

+28
-33
lines changed

lib/matplotlib/pyplot.py

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,13 @@ def rcdefaults():
327327

328328
def gci():
329329
"""
330-
Get the current colorable artist. Specifically, returns the
331-
current :class:`~matplotlib.cm.ScalarMappable` instance (image or
332-
patch collection), or *None* if no images or patch collections
333-
have been defined. The commands :func:`~matplotlib.pyplot.imshow`
334-
and :func:`~matplotlib.pyplot.figimage` create
335-
:class:`~matplotlib.image.Image` instances, and the commands
336-
:func:`~matplotlib.pyplot.pcolor` and
337-
:func:`~matplotlib.pyplot.scatter` create
338-
:class:`~matplotlib.collections.Collection` instances. The
339-
current image is an attribute of the current axes, or the nearest
330+
Get the current colorable artist.
331+
332+
Specifically, returns the current `.ScalarMappable` instance (`.Image`
333+
created by `imshow` or `figimage`, `.Collection` created by `pcolor` or
334+
`scatter`, etc.), or *None* if no such instance has been defined.
335+
336+
The current image is an attribute of the current axes, or the nearest
340337
earlier axes in the current figure that contains an image.
341338
"""
342339
return gcf()._gci()
@@ -473,7 +470,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
473470
Notes
474471
-----
475472
If you are creating many figures, make sure you explicitly call
476-
:func:`.pyplot.close` on the figures you are not using, because this will
473+
`.pyplot.close` on the figures you are not using, because this will
477474
enable pyplot to properly clean up the memory.
478475
479476
`~matplotlib.rcParams` defines the default values, which can be modified
@@ -675,19 +672,16 @@ def clf():
675672

676673

677674
def draw():
678-
"""Redraw the current figure.
675+
"""
676+
Redraw the current figure.
679677
680678
This is used to update a figure that has been altered, but not
681-
automatically re-drawn. If interactive mode is on (:func:`.ion()`), this
679+
automatically re-drawn. If interactive mode is on (via `.ion()`), this
682680
should be only rarely needed, but there may be ways to modify the state of
683-
a figure without marking it as `stale`. Please report these cases as
684-
bugs.
681+
a figure without marking it as "stale". Please report these cases as bugs.
685682
686-
A more object-oriented alternative, given any
687-
:class:`~matplotlib.figure.Figure` instance, :attr:`fig`, that
688-
was created using a :mod:`~matplotlib.pyplot` function, is::
689-
690-
fig.canvas.draw_idle()
683+
This is equivalent to calling ``fig.canvas.draw_idle()``, where ``fig`` is
684+
the current figure.
691685
"""
692686
get_current_fig_manager().canvas.draw_idle()
693687

@@ -1425,8 +1419,7 @@ def xticks(ticks=None, labels=None, **kwargs):
14251419
A list of explicit labels to place at the given *locs*.
14261420
14271421
**kwargs
1428-
:class:`.Text` properties can be used to control the appearance of
1429-
the labels.
1422+
`.Text` properties can be used to control the appearance of the labels.
14301423
14311424
Returns
14321425
-------
@@ -1501,8 +1494,7 @@ def yticks(ticks=None, labels=None, **kwargs):
15011494
A list of explicit labels to place at the given *locs*.
15021495
15031496
**kwargs
1504-
:class:`.Text` properties can be used to control the appearance of
1505-
the labels.
1497+
`.Text` properties can be used to control the appearance of the labels.
15061498
15071499
Returns
15081500
-------
@@ -2046,14 +2038,18 @@ def clim(vmin=None, vmax=None):
20462038

20472039
def set_cmap(cmap):
20482040
"""
2049-
Set the default colormap. Applies to the current image if any.
2050-
See help(colormaps) for more information.
2041+
Set the default colormap, and applies it to the current image if any.
20512042
2052-
*cmap* must be a :class:`~matplotlib.colors.Colormap` instance, or
2053-
the name of a registered colormap.
2043+
Parameters
2044+
----------
2045+
cmap : `~matplotib.colors.Colormap` or str
2046+
A colormap instance or the name of a registered colormap.
20542047
2055-
See :func:`matplotlib.cm.register_cmap` and
2056-
:func:`matplotlib.cm.get_cmap`.
2048+
See Also
2049+
--------
2050+
colormaps
2051+
matplotlib.cm.register_cmap
2052+
matplotlib.cm.get_cmap
20572053
"""
20582054
cmap = cm.get_cmap(cmap)
20592055

@@ -2134,9 +2130,8 @@ def polar(*args, **kwargs):
21342130
21352131
polar(theta, r, **kwargs)
21362132
2137-
Multiple *theta*, *r* arguments are supported, with format
2138-
strings, as in :func:`~matplotlib.pyplot.plot`.
2139-
2133+
Multiple *theta*, *r* arguments are supported, with format strings, as in
2134+
`plot`.
21402135
"""
21412136
# If an axis already exists, check if it has a polar projection
21422137
if gcf().get_axes():

0 commit comments

Comments
 (0)