8000 Merge pull request #9942 from timhoffm/pyplot-cleanup · matplotlib/matplotlib@9a935e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a935e7

Browse files
authored
Merge pull request #9942 from timhoffm/pyplot-cleanup
DOC: Minor doc formatting cleanups in pyplot
2 parents 31e851a + ba0aac9 commit 9a935e7

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

lib/matplotlib/pyplot.py

Lines changed: 18 additions & 16 deletions
< 78C3 tr class="diff-line-row">
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Note: The first part of this file can be modified in place, but the latter
22
# part is autogenerated by the boilerplate.py script.
3+
34
"""
4-
Provides a MATLAB-like plotting framework.
5+
`matplotlib.pyplot` is a state-based interface to matplotlib. It provides
6+
a MATLAB-like way of plotting.
57
6-
:mod:`~matplotlib.pylab` combines pyplot with numpy into a single namespace.
7-
This is convenient for interactive work, but for programming it
8-
is recommended that the namespaces be kept separate, e.g.::
8+
pyplot is mainly intended for interactive plots and simple cases of programmatic
9+
plot generation::
910
1011
import numpy as np
1112
import matplotlib.pyplot as plt
1213
13-
x = np.arange(0, 5, 0.1);
14+
x = np.arange(0, 5, 0.1)
1415
y = np.sin(x)
1516
plt.plot(x, y)
1617
18+
The object-oriented API is recommended for more complex plots.
1719
"""
1820
from __future__ import (absolute_import, division, print_function,
1921
unicode_literals)
@@ -260,13 +262,13 @@ def isinteractive():
260262

261263

262264
def ioff():
263-
'Turn interactive mode off.'
265+
"""Turn interactive mode off."""
264266
matplotlib.interactive(False)
265267
uninstall_repl_displayhook()
266268

267269

268270
def ion():
269-
'Turn interactive mode on.'
271+
"""Turn interactive mode on."""
270272
matplotlib.interactive(True)
271273
install_repl_displayhook()
272274

@@ -281,6 +283,8 @@ def pause(interval):
281283
This can be used for crude animation. For more complex animation, see
282284
:mod:`matplotlib.animation`.
283285
286+
Note
287+
----
284288
This function is experimental; its behavior may be changed or extended in a
285289
future release.
286290
"""
@@ -590,8 +594,7 @@ def _auto_draw_if_interactive(fig, val):
590594

591595

592596
def gcf():
593-
"Get a reference to the current figure."
594-
597+
"""Get a reference to the current figure."""
595598
figManager = _pylab_helpers.Gcf.get_active()
596599
if figManager is not None:
597600
return figManager.canvas.figure
@@ -609,7 +612,7 @@ def get_fignums():
609612

610613

611614
def get_figlabels():
612-
"Return a list of existing figure labels."
615+
"""Return a list of existing figure labels."""
613616
figManagers = _pylab_helpers.Gcf.get_all_fig_managers()
614617
figManagers.sort(key=lambda m: m.num)
615618
return [m.canvas.figure.get_label() for m in figManagers]
@@ -639,9 +642,9 @@ def close(*args):
639642
640643
``close()`` by itself closes the current figure
641644
642-
``close(h)`` where *h* is a :class:`Figure` instance, closes that figure
645+
``close(fig)`` closes the `~.Figure` instance *fig*
643646
644-
``close(num)`` closes figure number *num*
647+
``close(num)`` closes the figure number *num*
645648
646649
``close(name)`` where *name* is a string, closes figure with that label
647650
@@ -837,7 +840,6 @@ def hold(b=None):
837840
def ishold():
838841
"""
839842
Return the hold status of the current axes.
840-
841843
"""
842844
return gca()._hold
843845

@@ -1330,8 +1332,8 @@ def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
13301332
"""
13311333
Automatically adjust subplot parameters to give specified padding.
13321334
1333-
Parameters:
1334-
1335+
Parameters
1336+
----------
13351337
pad : float
13361338
padding between the figure edge and the edges of subplots, as a fraction of the font-size.
13371339
h_pad, w_pad : float
@@ -1341,8 +1343,8 @@ def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
13411343
(left, bottom, right, top) in the normalized figure
13421344
coordinate that the whole subplots area (including
13431345
labels) will fit into. Default is (0, 0, 1, 1).
1344-
"""
13451346
1347+
"""
13461348
fig = gcf()
13471349
fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
13481350

0 commit comments

Comments
 (0)
0