8000 Merge pull request #16162 from anntzer/commandless · matplotlib/matplotlib@d5f3571 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5f3571

Browse files
authored
Merge pull request #16162 from anntzer/commandless
(Mostly) avoid the term "command" in the docs.
2 parents 4c22297 + 0d4f2d5 commit d5f3571

File tree

19 files changed

+113
-139
lines changed

19 files changed

+113
-139
lines changed

examples/images_contours_and_fields/contourf_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
ax2.set_title('Listed colors (3 masked regions)')
8282
ax2.clabel(CS4, fmt='%2.1f', colors='w', fontsize=14)
8383

84-
# Notice that the colorbar command gets all the information it
84+
# Notice that the colorbar gets all the information it
8585
# needs from the ContourSet object, CS3.
8686
fig2.colorbar(CS3)
8787

examples/misc/transoffset.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
"""
2-
===========
3-
Transoffset
4-
===========
2+
======================
3+
transforms.offset_copy
4+
======================
55
6-
This illustrates the use of transforms.offset_copy to
6+
This illustrates the use of `.transforms.offset_copy` to
77
make a transform that positions a drawing element such as
88
a text string at a specified offset in screen coordinates
99
(dots or inches) relative to a location given in any
1010
coordinates.
1111
1212
Every Artist (Text, Line2D, etc.) has a transform that can be
1313
set when the Artist is created, such as by the corresponding
14-
pyplot command. By default this is usually the Axes.transData
15-
transform, going from data units to screen dots. We can
16-
use the offset_copy function to make a modified copy of
14+
pyplot function. By default this is usually the Axes.transData
15+
transform, going from data units to screen pixels. We can
16+
use the `.offset_copy` function to make a modified copy of
1717
this transform, where the modification consists of an
1818
offset.
1919
"""
@@ -32,7 +32,7 @@
3232
# If we want the same offset for each text instance,
3333
# we only need to make one transform. To get the
3434
# transform argument to offset_copy, we need to make the axes
35-
# first; the subplot command above is one way to do this.
35+
# first; the subplot function above is one way to do this.
3636
trans_offset = mtransforms.offset_copy(ax.transData, fig=fig,
3737
x=0.05, y=0.10, units='inches')
3838

lib/matplotlib/__init__.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@
1717
1818
at the ipython shell prompt.
1919
20-
For the most part, direct use of the object-oriented library is
21-
encouraged when programming; pyplot is primarily for working
22-
interactively. The
23-
exceptions are the pyplot commands :func:`~matplotlib.pyplot.figure`,
24-
:func:`~matplotlib.pyplot.subplot`,
25-
:func:`~matplotlib.pyplot.subplots`, and
26-
:func:`~pyplot.savefig`, which can greatly simplify scripting.
20+
For the most part, direct use of the object-oriented library is encouraged when
21+
programming; pyplot is primarily for working interactively. The exceptions are
22+
the pyplot functions `.pyplot.figure`, `.pyplot.subplot`, `.pyplot.subplots`,
23+
and `.pyplot.savefig`, which can greatly simplify scripting.
2724
2825
Modules include:
2926
3027
:mod:`matplotlib.axes`
31-
defines the :class:`~matplotlib.axes.Axes` class. Most pyplot
32-
commands are wrappers for :class:`~matplotlib.axes.Axes`
33-
methods. The axes module is the highest level of OO access to
34-
the library.
28+
defines the `~matplotlib.axes.Axes` class. Most pyplot functions are
29+
wrappers for `~matplotlib.axes.Axes` methods. The axes module is the
30+
highest level of OO access to the library.
3531
3632
:mod:`matplotlib.figure`
3733
defines the :class:`~matplotlib.figure.Figure` class.
@@ -923,7 +919,7 @@ def rc(group, **kwargs):
923919
'aa' 'antialiased'
924920
===== =================
925921
926-
Thus you could abbreviate the above rc command as::
922+
Thus you could abbreviate the above call as::
927923
928924
rc('lines', lw=2, c='r')
929925

lib/matplotlib/animation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +2 10000 30,7 @@ def grab_frame(self, **savefig_kwargs):
230230
Grab the image information from the figure and save as a movie frame.
231231
232232
All keyword arguments in *savefig_kwargs* are passed on to the
233-
`~.Figure.savefig` command that saves the figure.
233+
`~.Figure.savefig` call that saves the figure.
234234
"""
235235

236236
@abc.abstractmethod
@@ -1020,8 +1020,7 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
10201020
between the frames from the different animations.
10211021
10221022
savefig_kwargs : dict, optional
1023-
Is a dictionary containing keyword arguments to be passed
1024-
on to the `~.Figure.savefig` command which is called repeatedly to
1023+
Keyword arguments passed to each `~.Figure.savefig` call used to
10251024
save the individual frames.
10261025
10271026
progress_callback : function, optional

lib/matplotlib/axes/_axes.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def legend(self, *args, **kwargs):
352352
353353
Notes
354354
-----
355-
Not all kinds of artist are supported by the legend command. See
355+
Some artists are not supported by this function. See
356356
:doc:`/tutorials/intermediate/legend_guide` for details.
357357
358358
Examples
@@ -927,13 +927,11 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
927927
"""
928928
Add a horizontal span (rectangle) across the axis.
929929
930-
Draw a horizontal span (rectangle) from *ymin* to *ymax*.
931-
With the default values of *xmin* = 0 and *xmax* = 1, this
932-
always spans the xrange, regardless of the xlim settings, even
933-
if you change them, e.g., with the :meth:`set_xlim` command.
934-
That is, the horizontal extent is in axes coords: 0=left,
935-
0.5=middle, 1.0=right but the *y* location is in data
936-
coordinates.
930+
The rectangle spans from *ymin* to *ymax* vertically, and, by default,
931+
the whole x-axis horizontally. The x-span can be set using *xmin*
932+
(default: 0) and *xmax* (default: 1) which are in axis units; e.g.
933+
``xmin = 0.5`` always refers to the middle of the x-axis regardless of
934+
the limits set by `~.Axes.set_xlim`.
937935
938936
Parameters
939937
----------
@@ -981,12 +979,11 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
981979
"""
982980
Add a vertical span (rectangle) across the axes.
983981
984-
Draw a vertical span (rectangle) from *xmin* to *xmax*. With
985-
the default values of *ymin* = 0 and *ymax* = 1. This always
986-
spans the yrange, regardless of the ylim settings, even if you
987-
change them, e.g., with the :meth:`set_ylim` command. That is,
988-
the vertical extent is in axes coords: 0=bottom, 0.5=middle,
989-
1.0=top but the x location is in data coordinates.
982+
The rectangle spans from *xmin* to *xmax* horizontally, and, by
983+
default, the whole y-axis vertically. The y-span can be set using
984+
*ymin* (default: 0) and *ymax* (default: 1) which are in axis units;
985+
e.g. ``ymin = 0.5`` always refers to the middle of the y-axis
986+
regardless of the limits set by `~.Axes.set_ylim`.
990987
991988
Parameters
992989
----------
@@ -1535,7 +1532,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
15351532
>>> plot([1, 2, 3], [1, 2, 3], 'go-', label='line 1', linewidth=2)
15361533
>>> plot([1, 2, 3], [1, 4, 9], 'rs', label='line 2')
15371534
1538-
If you make multiple lines with one plot command, the kwargs
1535+
If you make multiple lines with one plot call, the kwargs
15391536
apply to all those lines.
15401537
15411538
Here is a list of available `.Line2D` properties:
@@ -3119,9 +3116,9 @@ def errorbar(self, x, y, yerr=None, xerr=None,
31193116
Other Parameters
31203117
----------------
31213118
**kwargs
3122-
All other keyword arguments are passed on to the plot
3123-
command for the markers. For example, this code makes big red
3124-
squares with thick green edges::
3119+
All other keyword arguments are passed on to the `~.Axes.plot` call
3120+
drawing the markers. For example, this code makes big red squares
3121+
with thick green edges::
31253122
31263123
x, y, yerr = rand(3, 10)
31273124
errorbar(x, y, yerr, marker='s', mfc='red',
@@ -6446,7 +6443,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
64466443
label : str or None, default: None
64476444
String, or sequence of strings to match multiple datasets. Bar
64486445
charts yield multiple patches per dataset, but only the first gets
6449-
the label, so that the legend command will work as expected.
6446+
the label, so that `~.Axes.legend` will work as expected.
64506447
64516448
stacked : bool, default: False
64526449
If ``True``, multiple data are stacked on top of each other If

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ def _process_plot_format(fmt):
116116

117117
class _process_plot_var_args:
118118
"""
119-
Process variable length arguments to the plot command, so that
120-
plot commands like the following are supported::
119+
Process variable length arguments to `~.Axes.plot`, to support ::
121120
122121
plot(t, s)
123122
plot(t1, s1, t2, s2)

lib/matplotlib/backends/backend_mixed.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,14 @@ def __getattr__(self, attr):
7676
def start_rasterizing(self):
7777
"""
7878
Enter "raster" mode. All subsequent drawing commands (until
79-
stop_rasterizing is called) will be drawn with the raster
80-
backend.
81-
82-
If start_rasterizing is called multiple times before
83-
stop_rasterizing is called, this method has no effect.
79+
`stop_rasterizing` is called) will be drawn with the raster backend.
8480
"""
85-
8681
# change the dpi of the figure temporarily.
8782
self.figure.set_dpi(self.dpi)
88-
8983
if self._bbox_inches_restore: # when tight bbox is used
9084
r = process_figure_for_rasterizing(self.figure,
9185
self._bbox_inches_restore)
9286
self._bbox_inches_restore = r
93-
9487
if self._rasterizing == 0:
9588
self._raster_renderer = self._raster_renderer_class(
9689
self._width*self.dpi, self._height*self.dpi, self.dpi)
@@ -100,11 +93,12 @@ def start_rasterizing(self):
10093
def stop_rasterizing(self):
10194
"""
10295
Exit "raster" mode. All of the drawing that was done since
103-
the last start_rasterizing command will be copied to the
96+
the last `start_rasterizing` call will be copied to the
10497
vector backend by calling draw_image.
10598
106-
If stop_rasterizing is called multiple times before
107-
start_rasterizing is called, this method has no effect.
99+
If `start_rasterizing` has been called multiple times,
100+
`stop_rasterizing` must be called the same number of times before
101+
"raster" mode is exited.
108102
"""
109103
self._rasterizing -= 1
110104
if self._rasterizing == 0:

lib/matplotlib/backends/backend_pgf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ def __init__(self):
275275
encoding="utf-8", cwd=self.tmpdir)
276276
except FileNotFoundError:
277277
raise RuntimeError(
278-
"Latex command not found. Install %r or change "
279-
"pgf.texsystem to the desired command." % self.texcommand)
278+
f"{self.texcommand} not found. Install it or change "
279+
f"rcParams['pgf.texsystem'] to an available TeX "
280+
f"implementation.")
280281
except OSError:
281282
raise RuntimeError("Error starting process %r" % self.texcommand)
282283
test_input = self.latex_header + latex_end
@@ -856,7 +857,7 @@ def _print_pgf_to_fh(self, fh, *args,
856857

857858
def print_pgf(self, fname_or_fh, *args, **kwargs):
858859
"""
859-
Output pgf commands for drawing the figure so it can be included and
860+
Output pgf macros for drawing the figure so it can be included and
860861
rendered in latex documents.
861862
"""
862863
if kwargs.get("dryrun", False):

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ def legend(self, *args, **kwargs):
17911791
17921792
Notes
17931793
-----
1794-
Not all kinds of artist are supported by the legend command. See
1794+
Some artists are not supported by this function. See
17951795
:doc:`/tutorials/intermediate/legend_guide` for details.
17961796
"""
17971797

lib/matplotlib/tests/test_figure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
@image_comparison(['figure_align_labels'],
1818
tol={'aarch64': 0.02}.get(platform.machine(), 0.0))
1919
def test_align_labels():
20-
# Check the figure.align_labels() command
2120
fig = plt.figure(tight_layout=True)
2221
gs = gridspec.GridSpec(3, 3)
2322

lib/matplotlib/tight_bbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
This module is to support *bbox_inches* option in savefig command.
2+
This module is to support the *bbox_inches* parameter in `.Figure.savefig`.
33
"""
44

55
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
22
Axislines includes modified implementation of the Axes class. The
33
biggest difference is that the artists responsible for drawing the axis spine,
4-
ticks, ticklabels and axis labels are separated out from mpl's Axis
4+
ticks, ticklabels and axis labels are separated out from Matplotlib's Axis
55
class. Originally, this change was motivated to support curvilinear
66
grid. Here are a few reasons that I came up with a new axes class:
77
88
* "top" and "bottom" x-axis (or "left" and "right" y-axis) can have
99
different ticks (tick locations and labels). This is not possible
10-
with the current mpl, although some twin axes trick can help.
10+
with the current Matplotlib, although some twin axes trick can help.
1111
1212
* Curvilinear grid.
1313
@@ -29,11 +29,10 @@
2929
* offsetText
3030
* label
3131
32-
Note that these are separate artists from Axis class of the
33-
original mpl, thus most of tick-related command in the original mpl
34-
won't work, although some effort has made to work with. For example,
35-
color and markerwidth of the ax.axis["bottom"].major_ticks will follow
36-
those of Axes.xaxis unless explicitly specified.
32+
Note that these are separate artists from `matplotlib.axis.Axis`, thus most
33+
tick-related functions in Matplotlib won't work. For example, color and
34+
markerwidth of the ``ax.axis["bottom"].major_ticks`` will follow those of
35+
Axes.xaxis unless explicitly specified.
3736
3837
In addition to AxisArtist, the Axes will have *gridlines* attribute,
3938
which obviously draws grid lines. The gridlines needs to be separated

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def example_plot(ax, fontsize=12, nodec=False):
105105
# Colorbars
106106
# =========
107107
#
108-
# If you create a colorbar with the :func:`~matplotlib.pyplot.colorbar`
109-
# command you need to make room for it. ``constrained_layout`` does this
108+
# If you create a colorbar with `.Figure.colorbar`,
109+
# you need to make room for it. ``constrained_layout`` does this
110110
# automatically. Note that if you specify ``use_gridspec=True`` it will be
111111
# ignored because this option is made for improving the layout via
112112
# ``tight_layout``.
@@ -498,17 +498,16 @@ def docomplicated(suptitle=None):
498498
#
499499
#
500500
# Limitations
501-
# ========================
501+
# ===========
502502
#
503503
# Incompatible functions
504504
# ----------------------
505505
#
506-
# ``constrained_layout`` will not work on subplots
507-
# created via the `.pyplot.subplot` command. The reason is that each of these
508-
# commands creates a separate `.GridSpec` instance and ``constrained_layout``
509-
# uses (nested) gridspecs to carry out the layout. So the following fails
510-
# to yield a nice layout:
511-
506+
# ``constrained_layout`` will not work on subplots created via
507+
# `.pyplot.subplot`. The reason is that each call to `.pyplot.subplot` creates
508+
# a separate `.GridSpec` instance and ``constrained_layout`` uses (nested)
509+
# gridspecs to carry out the layout. So the following fails to yield a nice
510+
# layout:
512511

513512
fig = plt.figure()
514513

tutorials/intermediate/tight_layout_guide.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ def example_plot(ax, fontsize=12):
4747
###############################################################################
4848
# To prevent this, the location of axes needs to be adjusted. For
4949
# subplots, this can be done by adjusting the subplot params
50-
# (:ref:`howto-subplots-adjust`). Matplotlib v1.1 introduces a new
51-
# command :func:`~matplotlib.pyplot.tight_layout` that does this
52-
# automatically for you.
50+
# (:ref:`howto-subplots-adjust`). Matplotlib v1.1 introduced
51+
# `.Figure.tight_layout` that does this automatically for you.
5352

5453
fig, ax = plt.subplots()
5554
example_plot(ax, fontsize=24)
@@ -336,10 +335,9 @@ def example_plot(ax, fontsize=12):
336335
# Colorbar
337336
# ========
338337
#
339-
# If you create a colorbar with the :func:`~matplotlib.pyplot.colorbar`
340-
# command, the created colorbar is an instance of Axes, *not* Subplot, so
341-
# tight_layout does not work. With Matplotlib v1.1, you may create a
342-
# colorbar as a subplot using the gridspec.
338+
# If you create a colorbar with `.Figure.colorbar`, the created colorbar is
339+
# an instance of Axes, *not* Subplot, so tight_layout does not work. With
340+
# Matplotlib v1.1, you may create a colorbar as a subplot using the gridspec.
343341

344342
plt.close('all')
345343
arr = np.arange(100).reshape((10, 10))

tutorials/introductory/customizing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@
112112

113113
###############################################################################
114114
# Matplotlib also provides a couple of convenience functions for modifying rc
115-
# settings. The :func:`matplotlib.rc` command can be used to modify multiple
115+
# settings. `matplotlib.rc` can be used to modify multiple
116116
# settings in a single group at once, using keyword arguments:
117117

118118
mpl.rc('lines', linewidth=4, color='g')
119119
plt.plot(data)
120120

121121
###############################################################################
122-
# The :func:`matplotlib.rcdefaults` command will restore the standard matplotlib
122+
# `matplotlib.rcdefaults` will restore the standard matplotlib
123123
# default settings.
124124
#
125125
# There is some degree of validation when setting the values of rcParams, see

0 commit comments

Comments
 (0)
0