Skip to content

Commit 50137ee

Browse files
committed
DOC: Spell out args & kwargs in example text.
1 parent 9091ba9 commit 50137ee

File tree

20 files changed

+64
-67
lines changed

20 files changed

+64
-67
lines changed

examples/images_contours_and_fields/contourf_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
fig1, ax2 = plt.subplots(constrained_layout=True)
4242
CS = ax2.contourf(X, Y, Z, 10, cmap=plt.cm.bone, origin=origin)
4343

44-
# Note that in the following, we explicitly pass in a subset of
45-
# the contour levels used for the filled contours. Alternatively,
46-
# We could pass in additional levels to provide extra resolution,
47-
# or leave out the levels kwarg to use all of the original levels.
44+
# Note that in the following, we explicitly pass in a subset of the contour
45+
# levels used for the filled contours. Alternatively, we could pass in
46+
# additional levels to provide extra resolution, or leave out the *levels*
47+
# keyword argument to use all of the original levels.
4848

4949
CS2 = ax2.contour(CS, levels=CS.levels[::2], colors='r', origin=origin)
5050

examples/images_contours_and_fields/tripcolor_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
# object if the same triangulation was to be used more than once to save
114114
# duplicated calculations.
115115
# Can specify one color value per face rather than one per point by using the
116-
# facecolors kwarg.
116+
# *facecolors* keyword argument.
117117

118118
fig3, ax3 = plt.subplots()
119119
ax3.set_aspect('equal')

examples/lines_bars_and_markers/filled_step.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v',
2020
"""
2121
Draw a histogram as a stepped patch.
2222
23-
Extra kwargs are passed through to `fill_between`
24-
2523
Parameters
2624
----------
2725
ax : Axes
@@ -41,6 +39,9 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v',
4139
Orientation of the histogram. 'v' (default) has
4240
the bars increasing in the positive y-direction.
4341
42+
**kwargs
43+
Extra keyword arguments are passed through to `.fill_between`.
44+
4445
Returns
4546
-------
4647
ret : PolyCollection
@@ -116,9 +117,9 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
116117
label=label, **kwargs)
117118
118119
plot_kwargs : dict, optional
119-
Any extra kwargs to pass through to the plotting function. This
120-
will be the same for all calls to the plotting function and will
121-
over-ride the values in cycle.
120+
Any extra keyword arguments to pass through to the plotting function.
121+
This will be the same for all calls to the plotting function and will
122+
override the values in cycle.
122123
123124
Returns
124125
-------

examples/lines_bars_and_markers/gradient_bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs):
3434
extent
3535
The extent of the image as (xmin, xmax, ymin, ymax).
3636
By default, this is in Axes coordinates but may be
37-
changed using the *transform* kwarg.
37+
changed using the *transform* keyword argument.
3838
direction : float
3939
The direction of the gradient. This is a number in
4040
range 0 (=vertical) to 1 (=horizontal).

examples/shapes_and_collections/collections.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
Line, Poly and RegularPoly Collection with autoscaling
44
=========================================================
55
6-
For the first two subplots, we will use spirals. Their
7-
size will be set in plot units, not data units. Their positions
8-
will be set in data units by using the "offsets" and "transOffset"
9-
kwargs of the `~.collections.LineCollection` and
10-
`~.collections.PolyCollection`.
6+
For the first two subplots, we will use spirals. Their size will be set in
7+
plot units, not data units. Their positions will be set in data units by using
8+
the *offsets* and *transOffset* keyword arguments of the `.LineCollection` and
9+
`.PolyCollection`.
1110
1211
The third subplot will make regular polygons, with the same
1312
type of scaling and positioning as in the first two.
@@ -60,7 +59,7 @@
6059
# but it is good enough to generate a plot that you can use
6160
# as a starting point. If you know beforehand the range of
6261
# x and y that you want to show, it is better to set them
63-
# explicitly, leave out the autolim kwarg (or set it to False),
62+
# explicitly, leave out the *autolim* keyword argument (or set it to False),
6463
# and omit the 'ax1.autoscale_view()' call below.
6564

6665
# Make a transform for the line segments such that their size is

examples/specialty_plots/topographic_hillshading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
In most cases, hillshading is used purely for visual purposes, and *dx*/*dy*
1414
can be safely ignored. In that case, you can tweak *vert_exag* (vertical
1515
exaggeration) by trial and error to give the desired visual effect. However,
16-
this example demonstrates how to use the *dx* and *dy* kwargs to ensure that
17-
the *vert_exag* parameter is the true vertical exaggeration.
16+
this example demonstrates how to use the *dx* and *dy* keyword arguments to
17+
ensure that the *vert_exag* parameter is the true vertical exaggeration.
1818
"""
1919
import numpy as np
2020
import matplotlib.pyplot as plt

examples/statistics/boxplot.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
Artist customization in box plots
44
=================================
55
6-
This example demonstrates how to use the various kwargs
7-
to fully customize box plots. The first figure demonstrates
8-
how to remove and add individual components (note that the
9-
mean is the only value not shown by default). The second
10-
figure demonstrates how the styles of the artists can
11-
be customized. It also demonstrates how to set the limit
12-
of the whiskers to specific percentiles (lower right axes)
13-
14-
A good general reference on boxplots and their history can be found
15-
here: http://vita.had.co.nz/papers/boxplots.pdf
6+
This example demonstrates how to use the various keyword arguments to fully
7+
customize box plots. The first figure demonstrates how to remove and add
8+
individual components (note that the mean is the only value not shown by
9+
default). The second figure demonstrates how the styles of the artists can be
10+
customized. It also demonstrates how to set the limit of the whiskers to
11+
specific percentiles (lower right axes)
12+
13+
A good general reference on boxplots and their history can be found here:
14+
https://vita.had.co.nz/papers/boxplots.pdf
1615
1716
"""
1817

examples/statistics/confidence_ellipse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def get_correlated_dataset(n, dependency, mu, scale):
190190
# Using the keyword arguments
191191
# """""""""""""""""""""""""""
192192
#
193-
# Use the kwargs specified for matplotlib.patches.Patch in order
193+
# Use the keyword arguments specified for `matplotlib.patches.Patch` in order
194194
# to have the ellipse rendered in different ways.
195195

196196
fig, ax_kwargs = plt.subplots(figsize=(6, 6))
@@ -210,7 +210,7 @@ def get_correlated_dataset(n, dependency, mu, scale):
210210

211211
ax_kwargs.scatter(x, y, s=0.5)
212212
ax_kwargs.scatter(mu[0], mu[1], c='red', s=3)
213-
ax_kwargs.set_title('Using kwargs')
213+
ax_kwargs.set_title('Using keyword arguments')
214214

215215
fig.subplots_adjust(hspace=0.25)
216216
plt.show()

examples/statistics/customized_violin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
Violin plot customization
44
=========================
55
6-
This example demonstrates how to fully customize violin plots.
7-
The first plot shows the default style by providing only
8-
the data. The second plot first limits what matplotlib draws
9-
with additional kwargs. Then a simplified representation of
10-
a box plot is drawn on top. Lastly, the styles of the artists
11-
of the violins are modified.
6+
This example demonstrates how to fully customize violin plots. The first plot
7+
shows the default style by providing only the data. The second plot first
8+
limits what Matplotlib draws with additional keyword arguments. Then a
9+
simplified representation of a box plot is drawn on top. Lastly, the styles of
10+
the artists of the violins are modified.
1211
1312
For more information on violin plots, the scikit-learn docs have a great
1413
section: https://scikit-learn.org/stable/modules/density.html

examples/statistics/errorbars_and_boxes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
1. an `~.axes.Axes` object is passed directly to the function
1313
2. the function operates on the ``Axes`` methods directly, not through
1414
the ``pyplot`` interface
15-
3. plotting kwargs that could be abbreviated are spelled out for
16-
better code readability in the future (for example we use
17-
``facecolor`` instead of ``fc``)
15+
3. plotting keyword arguments that could be abbreviated are spelled out for
16+
better code readability in the future (for example we use *facecolor*
17+
instead of *fc*)
1818
4. the artists returned by the ``Axes`` plotting methods are then
1919
returned by the function so that, if desired, their styles
2020
can be modified later outside of the function (they are not

0 commit comments

Comments
 (0)