Skip to content

Commit dd6309a

Browse files
oscargusmeeseeksmachine
authored andcommitted
Backport PR #23995: DOC: Lowercase some parameter names
1 parent 1d3c233 commit dd6309a

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

lib/matplotlib/tests/test_triangulation.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def test_tripcolor_color():
243243
fig, ax = plt.subplots()
244244
with pytest.raises(TypeError, match=r"tripcolor\(\) missing 1 required "):
245245
ax.tripcolor(x, y)
246-
with pytest.raises(ValueError, match="The length of C must match either"):
246+
with pytest.raises(ValueError, match="The length of c must match either"):
247247
ax.tripcolor(x, y, [1, 2, 3])
248248
with pytest.raises(ValueError,
249249
match="length of facecolors must match .* triangles"):
@@ -255,7 +255,7 @@ def test_tripcolor_color():
255255
match="'gouraud' .* at the points.* not at the faces"):
256256
ax.tripcolor(x, y, [1, 2], shading='gouraud') # faces
257257
with pytest.raises(TypeError,
258-
match="positional.*'C'.*keyword-only.*'facecolors'"):
258+
match="positional.*'c'.*keyword-only.*'facecolors'"):
259259
ax.tripcolor(x, y, C=[1, 2, 3, 4])
260260

261261
# smoke test for valid color specifications (via C or facecolors)
@@ -278,16 +278,16 @@ def test_tripcolor_clim():
278278
def test_tripcolor_warnings():
279279
x = [-1, 0, 1, 0]
280280
y = [0, -1, 0, 1]
281-
C = [0.4, 0.5]
281+
c = [0.4, 0.5]
282282
fig, ax = plt.subplots()
283283
# additional parameters
284284
with pytest.warns(DeprecationWarning, match="Additional positional param"):
285-
ax.tripcolor(x, y, C, 'unused_positional')
286-
# facecolors takes precedence over C
287-
with pytest.warns(UserWarning, match="Positional parameter C .*no effect"):
288-
ax.tripcolor(x, y, C, facecolors=C)
289-
with pytest.warns(UserWarning, match="Positional parameter C .*no effect"):
290-
ax.tripcolor(x, y, 'interpreted as C', facecolors=C)
285+
ax.tripcolor(x, y, c, 'unused_positional')
286+
# facecolors takes precedence over c
287+
with pytest.warns(UserWarning, match="Positional parameter c .*no effect"):
288+
ax.tripcolor(x, y, c, facecolors=c)
289+
with pytest.warns(UserWarning, match="Positional parameter c .*no effect"):
290+
ax.tripcolor(x, y, 'interpreted as c', facecolors=c)
291291

292292

293293
def test_no_modify():

lib/matplotlib/tri/tricontour.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ def _contour_args(self, args, kwargs):
8383
8484
Call signatures::
8585
86-
%%(func)s(triangulation, Z, [levels], ...)
87-
%%(func)s(x, y, Z, [levels], *, [triangles=triangles], [mask=mask], ...)
86+
%%(func)s(triangulation, z, [levels], ...)
87+
%%(func)s(x, y, z, [levels], *, [triangles=triangles], [mask=mask], ...)
8888
8989
The triangular grid can be specified either by passing a `.Triangulation`
9090
object as the first parameter, or by passing the points *x*, *y* and
@@ -93,7 +93,7 @@ def _contour_args(self, args, kwargs):
9393
*triangles* are given, the triangulation is calculated on the fly.
9494
9595
It is possible to pass *triangles* positionally, i.e.
96-
``%%(func)s(x, y, triangles, Z, ...)``. However, this is discouraged. For more
96+
``%%(func)s(x, y, triangles, z, ...)``. However, this is discouraged. For more
9797
clarity, pass *triangles* via keyword argument.
9898
9999
Parameters
@@ -105,7 +105,7 @@ def _contour_args(self, args, kwargs):
105105
Parameters defining the triangular grid. See `.Triangulation`.
106106
This is mutually exclusive with specifying *triangulation*.
107107
108-
Z : array-like
108+
z : array-like
109109
The height values over which the contour is drawn. Color-mapping is
110110
controlled by *cmap*, *norm*, *vmin*, and *vmax*.
111111
@@ -157,20 +157,20 @@ def _contour_args(self, args, kwargs):
157157
This parameter is ignored if *colors* is set.
158158
159159
origin : {*None*, 'upper', 'lower', 'image'}, default: None
160-
Determines the orientation and exact position of *Z* by specifying the
161-
position of ``Z[0, 0]``. This is only relevant, if *X*, *Y* are not given.
160+
Determines the orientation and exact position of *z* by specifying the
161+
position of ``z[0, 0]``. This is only relevant, if *X*, *Y* are not given.
162162
163-
- *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
164-
- 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
165-
- 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
163+
- *None*: ``z[0, 0]`` is at X=0, Y=0 in the lower left corner.
164+
- 'lower': ``z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
165+
- 'upper': ``z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left corner.
166166
- 'image': Use the value from :rc:`image.origin`.
167167
168168
extent : (x0, x1, y0, y1), optional
169169
If *origin* is not *None*, then *extent* is interpreted as in `.imshow`: it
170-
gives the outer pixel boundaries. In this case, the position of Z[0, 0] is
170+
gives the outer pixel boundaries. In this case, the position of z[0, 0] is
171171
the center of the pixel, not a corner. If *origin* is *None*, then
172-
(*x0*, *y0*) is the position of Z[0, 0], and (*x1*, *y1*) is the position
173-
of Z[-1, -1].
172+
(*x0*, *y0*) is the position of z[0, 0], and (*x1*, *y1*) is the position
173+
of z[-1, -1].
174174
175175
This argument is ignored if *X* and *Y* are specified in the call to
176176
contour.

lib/matplotlib/tri/tripcolor.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
1313
1414
Call signatures::
1515
16-
tripcolor(triangulation, C, *, ...)
17-
tripcolor(x, y, C, *, [triangles=triangles], [mask=mask], ...)
16+
tripcolor(triangulation, c, *, ...)
17+
tripcolor(x, y, c, *, [triangles=triangles], [mask=mask], ...)
1818
1919
The triangular grid can be specified either by passing a `.Triangulation`
2020
object as the first parameter, or by passing the points *x*, *y* and
2121
optionally the *triangles* and a *mask*. See `.Triangulation` for an
2222
explanation of these parameters.
2323
2424
It is possible to pass the triangles positionally, i.e.
25-
``tripcolor(x, y, triangles, C, ...)``. However, this is discouraged.
25+
``tripcolor(x, y, triangles, c, ...)``. However, this is discouraged.
2626
For more clarity, pass *triangles* via keyword argument.
2727
2828
If neither of *triangulation* or *triangles* are given, the triangulation
2929
is calculated on the fly. In this case, it does not make sense to provide
30-
colors at the triangle faces via *C* or *facecolors* because there are
30+
colors at the triangle faces via *c* or *facecolors* because there are
3131
multiple possible triangulations for a group of points and you don't know
3232
which triangles will be constructed.
3333
@@ -38,21 +38,21 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
3838
x, y, triangles, mask
3939
Parameters defining the triangular grid. See `.Triangulation`.
4040
This is mutually exclusive with specifying *triangulation*.
41-
C : array-like
41+
c : array-like
4242
The color values, either for the points or for the triangles. Which one
43-
is automatically inferred from the length of *C*, i.e. does it match
43+
is automatically inferred from the length of *c*, i.e. does it match
4444
the number of points or the number of triangles. If there are the same
4545
number of points and triangles in the triangulation it is assumed that
4646
color values are defined at points; to force the use of color values at
47-
triangles use the keyword argument ``facecolors=C`` instead of just
48-
``C``.
47+
triangles use the keyword argument ``facecolors=c`` instead of just
48+
``c``.
4949
This parameter is position-only.
5050
facecolors : array-like, optional
51-
Can be used alternatively to *C* to specify colors at the triangle
52-
faces. This parameter takes precedence over *C*.
51+
Can be used alternatively to *c* to specify colors at the triangle
52+
faces. This parameter takes precedence over *c*.
5353
shading : {'flat', 'gouraud'}, default: 'flat'
54-
If 'flat' and the color values *C* are defined at points, the color
55-
values used for each triangle are from the mean C of the triangle's
54+
If 'flat' and the color values *c* are defined at points, the color
55+
values used for each triangle are from the mean c of the triangle's
5656
three points. If *shading* is 'gouraud' then color values must be
5757
defined at points.
5858
other_parameters
@@ -68,34 +68,34 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None,
6868
if facecolors is not None:
6969
if args:
7070
_api.warn_external(
71-
"Positional parameter C has no effect when the keyword "
71+
"Positional parameter c has no effect when the keyword "
7272
"facecolors is given")
7373
point_colors = None
7474
if len(facecolors) != len(tri.triangles):
7575
raise ValueError("The length of facecolors must match the number "
7676
"of triangles")
7777
else:
78-
# Color from positional parameter C
78+
# Color from positional parameter c
7979
if not args:
8080
raise TypeError(
81-
"tripcolor() missing 1 required positional argument: 'C'; or "
81+
"tripcolor() missing 1 required positional argument: 'c'; or "
8282
"1 required keyword-only argument: 'facecolors'")
8383
elif len(args) > 1:
8484
_api.warn_deprecated(
8585
"3.6", message=f"Additional positional parameters "
8686
f"{args[1:]!r} are ignored; support for them is deprecated "
8787
f"since %(since)s and will be removed %(removal)s")
88-
C = np.asarray(args[0])
89-
if len(C) == len(tri.x):
88+
c = np.asarray(args[0])
89+
if len(c) == len(tri.x):
9090
# having this before the len(tri.triangles) comparison gives
9191
# precedence to nodes if there are as many nodes as triangles
92-
point_colors = C
92+
point_colors = c
9393
facecolors = None
94-
elif len(C) == len(tri.triangles):
94+
elif len(c) == len(tri.triangles):
9595
point_colors = None
96-
facecolors = C
96+
facecolors = c
9797
else:
98-
raise ValueError('The length of C must match either the number '
98+
raise ValueError('The length of c must match either the number '
9999
'of points or the number of triangles')
100100

101101
# Handling of linewidths, shading, edgecolors and antialiased as

0 commit comments

Comments
 (0)