8000 DOC: Spell out args & kwargs in tutorials. · matplotlib/matplotlib@203f8a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 203f8a0

Browse files
committed
DOC: Spell out args & kwargs in tutorials.
1 parent e87f595 commit 203f8a0

File tree

7 files changed

+29
-28
lines changed

7 files changed

+29
-28
lines changed

tutorials/intermediate/constrainedlayout_guide.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def example_plot(ax, fontsize=12, hide_labels=False):
7979
# To prevent this, the location of axes needs to be adjusted. For
8080
# subplots, this can be done by adjusting the subplot params
8181
# (:ref:`howto-subplots-adjust`). However, specifying your figure with the
82-
# ``constrained_layout=True`` kwarg will do the adjusting automatically.
82+
# ``constrained_layout=True`` keyword argument will do the adjusting
83+
# automatically.
8384

8485
fig, ax = plt.subplots(constrained_layout=True)
8586
example_plot(ax, fontsize=24)
@@ -112,7 +113,7 @@ def example_plot(ax, fontsize=12, hide_labels=False):
112113
#
113114
# .. note::
114115
#
115-
# For the `~.axes.Axes.pcolormesh` kwargs (``pc_kwargs``) we use a
116+
# For the `~.axes.Axes.pcolormesh` keyword arguments (``pc_kwargs``) we use a
116117
# dictionary. Below we will assign one colorbar to a number of axes each
117118
# containing a `~.cm.ScalarMappable`; specifying the norm and colormap
118119
# ensures the colorbar is accurate for all the axes.

tutorials/intermediate/imshow_extent.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
*origin* and *extent* in `~.Axes.imshow`
33
========================================
44
5-
:meth:`~.Axes.imshow` allows you to render an image (either a 2D array
6-
which will be color-mapped (based on *norm* and *cmap*) or a 3D RGB(A)
7-
array which will be used as-is) to a rectangular region in data space.
8-
The orientation of the image in the final rendering is controlled by
9-
the *origin* and *extent* kwargs (and attributes on the resulting
10-
`.AxesImage` instance) and the data limits of the axes.
11-
12-
The *extent* kwarg controls the bounding box in data coordinates that
13-
the image will fill specified as ``(left, right, bottom, top)`` in
14-
**data coordinates**, the *origin* kwarg controls how the image fills
15-
that bounding box, and the orientation in the final rendered image is
16-
also affected by the axes limits.
5+
:meth:`~.Axes.imshow` allows you to render an image (either a 2D array which
6+
will be color-mapped (based on *norm* and *cmap*) or a 3D RGB(A) array which
7+
will be used as-is) to a rectangular region in data space. The orientation of
8+
the image in the final rendering is controlled by the *origin* and *extent*
9+
keyword arguments (and attributes on the resulting `.AxesImage` instance) and
10+
the data limits of the axes.
11+
12+
The *extent* keyword arguments controls the bounding box in data coordinates
13+
that the image will fill specified as ``(left, right, bottom, top)`` in **data
14+
coordinates**, the *origin* keyword argument controls how the image fills that
15+
bounding box, and the orientation in the final rendered image is also affected
16+
by the axes limits.
1717
1818
.. hint:: Most of the code below is used for adding labels and informative
1919
text to the plots. The described effects of *origin* and *extent* can be

tutorials/introductory/lifecycle.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@
169169

170170
###############################################################################
171171
# We can also adjust the size of this plot using the :func:`pyplot.subplots`
172-
# function. We can do this with the ``figsize`` kwarg.
172+
# function. We can do this with the *figsize* keyword argument.
173173
#
174174
# .. note::
175175
#
176-
# While indexing in NumPy follows the form (row, column), the figsize
177-
# kwarg follows the form (width, height). This follows conventions in
178-
# visualization, which unfortunately are different from those of linear
179-
# algebra.
176+
# While indexing in NumPy follows the form (row, column), the *figsize*
177+
# keyword argument follows the form (width, height). This follows
178+
# conventions in visualization, which unfortunately are different from those
179+
# of linear algebra.
180180

181181
fig, ax = plt.subplots(figsize=(8, 4))
182182
ax.barh(group_names, group_data)
@@ -198,7 +198,7 @@
198198

199199

200200
def currency(x, pos):
201-
"""The two args are the value and tick position"""
201+
"""The two arguments are the value and tick position"""
202202
if x >= 1e6:
203203
s = '${:1.1f}M'.format(x*1e-6)
204204
else:

tutorials/introductory/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
# antialiased, etc; see `matplotlib.lines.Line2D`. There are
151151
# several ways to set line properties
152152
#
153-
# * Use keyword args::
153+
# * Use keyword arguments::
154154
#
155155
# plt.plot(x, y, linewidth=2.0)
156156
#
@@ -171,7 +171,7 @@
171171
# MATLAB-style string/value pairs::
172172
#
173173
# lines = plt.plot(x1, y1, x2, y2)
174-
# # use keyword args
174+
# # use keyword arguments
175175
# plt.setp(lines, color='r', linewidth=2.0)
176176
# # or MATLAB style string value pairs
177177
# plt.setp(lines, 'color', 'r', 'linewidth', 2.0)

tutorials/introductory/usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def my_plotter(ax, data1, data2, param_dict):
223223
The y data
224224
225225
param_dict : dict
226-
Dictionary of kwargs to pass to ax.plot
226+
Dictionary of keyword arguments to pass to ax.plot
227227
228228
Returns
229229
-------

tutorials/text/text_intro.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
# *position*, via which we can manually specify the label positions. Here we
154154
# put the xlabel to the far left of the axis. Note, that the y-coordinate of
155155
# this position has no effect - to adjust the y-position we need to use the
156-
# *labelpad* kwarg.
156 B41A +
# *labelpad* keyword argument.
157157

158158
fig, ax = plt.subplots(figsize=(5, 3))
159159
fig.subplots_adjust(bottom=0.15, left=0.2)
@@ -165,8 +165,8 @@
165165

166166
##############################################################################
167167
# All the labelling in this tutorial can be changed by manipulating the
168-
# `matplotlib.font_manager.FontProperties` method, or by named kwargs to
169-
# `~matplotlib.axes.Axes.set_xlabel`
168+
# `matplotlib.font_manager.FontProperties` method, or by named keyword
169+
# arguments to `~matplotlib.axes.Axes.set_xlabel`
170170

171171
from matplotlib.font_manager import FontProperties
172172

tutorials/text/text_props.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@
213213
#
214214
# font.sans-serif: Source Han Sans TW, Arial, sans-serif
215215
#
216-
# To control the font used on per-artist basis use the ``'name'``,
217-
# ``'fontname'`` or ``'fontproperties'`` kwargs documented :doc:`above
216+
# To control the font used on per-artist basis use the *name*, *fontname* or
217+
# *fontproperties* keyword arguments documented :doc:`above
218218
# </tutorials/text/text_props>`.
219219
#
220220
#

0 commit comments

Comments
 (0)
0