Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9cdfc0

Browse files
committed
fix naming of 'c' and drop the adjective 'named'
1 parent 607b4d6 commit e9cdfc0

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,15 +3878,15 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
38783878
except ValueError:
38793879
raise ValueError("'color' kwarg must be an mpl color"
38803880
" spec or sequence of color specs.\n"
3881-
"For a sequence of values to be"
3882-
" color-mapped, use the 'c' kwarg instead.")
3881+
"For a sequence of values to be color-mapped,"
3882+
" use the 'c' argument instead.")
38833883
if edgecolors is None:
38843884
edgecolors = co
38853885
if facecolors is None:
38863886
facecolors = co
38873887
if c is not None:
3888-
raise ValueError("Supply a 'c' kwarg or a 'color' kwarg"
3889-
" but not both; they differ but"
3888+
raise ValueError("Supply a 'c' argument or a 'color'"
3889+
" kwarg but not both; they differ but"
38903890
" their functionalities overlap.")
38913891
if c is None:
38923892
if facecolors is not None:
@@ -3943,7 +3943,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39433943
else:
39443944
if c_array.shape in ((3,), (4,)):
39453945
_log.warning(
3946-
"'c' kwarg looks like a **single** numeric RGB or "
3946+
"'c' argument looks like a single numeric RGB or "
39473947
"RGBA sequence, which should be avoided as value-"
39483948
"mapping will have precedence in case its length "
39493949
"matches with 'x' & 'y'. Please use a 2-D array "
@@ -3968,15 +3968,16 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39683968
except ValueError:
39693969
if not valid_shape: # but at least one conversion succeeded.
39703970
raise ValueError(
3971-
"'c' kwarg has {nc} elements, which is not acceptable "
3972-
"for use with 'x' with size {xs}, 'y' with size {ys}."
3971+
"'c' argument has {nc} elements, which is not "
3972+
"acceptable for use with 'x' with size {xs}, "
3973+
"'y' with size {ys}."
39733974
.format(nc=n_elem, xs=x.size, ys=y.size)
39743975
)
39753976
# Both the mapping *and* the RGBA conversion failed: pretty
39763977
# severe failure => one may appreciate a verbose feedback.
39773978
raise ValueError(
3978-
"'c' kwarg must either be valid as mpl color(s) or "
3979-
"as numbers to be mapped to colors. "
3979+
"'c' argument must either be valid as mpl color(s) "
3980+
"or as numbers to be mapped to colors. "
39803981
"Here c = {}." # <- beware, could be long depending on c.
39813982
.format(c)
39823983
)

lib/matplotlib/tests/test_axes.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,10 +1716,10 @@ def test_scatter_color(self):
17161716
with pytest.raises(ValueError):
17171717
plt.scatter([1, 2, 3], [1, 2, 3], color=[1, 2, 3])
17181718

1719-
# Parameters for *test_scatter_c_kwarg*. NB: assuming that
1720-
# the scatter plot will have 4 elements. The tuple scheme is:
1719+
# Parameters for *test_scatter_c*. NB: assuming that the
1720+
# scatter plot will have 4 elements. The tuple scheme is:
17211721
# (*c* parameter case, exception regexp key or None if no exception)
1722-
params_scatter_c_kwarg = [
1722+
params_test_scatter_c = [
17231723
# Single letter-sequences
17241724
("rgby", None),
17251725
("rgb", "shape"),
@@ -1759,12 +1759,13 @@ def test_scatter_color(self):
17591759
([[1, 0, 0, 0.5], "red", "0.0", "C5", "jaune"], "conversion"),
17601760
]
17611761

1762-
@pytest.mark.parametrize('c_case, re_key', params_scatter_c_kwarg)
1763-
def test_scatter_c_kwarg(self, c_case, re_key):
1762+
@pytest.mark.parametrize('c_case, re_key', params_test_scatter_c)
1763+
def test_scatter_c(self, c_case, re_key):
17641764
# Additional checking of *c* (introduced in #11383).
1765-
REGEXP = {"shape": "^'c' kwarg has [0-9]+ elements", # shape mismatch
1766-
"conversion": "^'c' kwarg must either be valid", # bad vals
1767-
}
1765+
REGEXP = {
1766+
"shape": "^'c' argument has [0-9]+ elements", # shape mismatch
1767+
"conversion": "^'c' argument must either be valid", # bad vals
1768+
}
17681769
x = y = [0, 1, 2, 3]
17691770
fig, ax = plt.subplots()
17701771

0 commit comments

Comments
 (0)