Skip to content

Commit 5e94951

Browse files
author
Moritz Schreiber
committed
add docstring
1 parent 021aadd commit 5e94951

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

pandas/plotting/_core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,14 @@ def scatter(self, x, y, s=None, c=None, **kwargs):
16431643
marker points according to a colormap.
16441644
16451645
**kwargs
1646+
size : str, int or array-like, optional
1647+
The color of each point. Alias for `s`.
1648+
`s` and `size` aren't allowed at the same time.
1649+
.. versionadded:: 1.4.1
1650+
color : str, int or array-like, optional
1651+
The color of each point. Alias for `c`.
1652+
`c` and `color` aren't allowed at the same time.
1653+
.. versionadded:: 1.4.1
16461654
Keyword arguments to pass on to :meth:`DataFrame.plot`.
16471655
16481656
Returns

pandas/tests/plotting/frame/test_frame_color.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,10 @@ def test_bar_colors(self):
119119
tm.close()
120120

121121
custom_colors = "rgcby"
122-
ax = df.plot.bar(color=custom_colors)
123-
self._check_colors(ax.patches[::5], facecolors=custom_colors)
124-
tm.close()
125-
126-
custom_colors = "rgcby"
127-
ax = df.plot.bar(c=custom_colors)
128-
self._check_colors(ax.patches[::5], facecolors=custom_colors)
129-
tm.close()
122+
for kw in ["c", "color"]:
123+
ax = df.plot.bar(**{kw: "rgcby"})
124+
self._check_colors(ax.patches[::5], facecolors=custom_colors)
125+
tm.close()
130126

131127
from matplotlib import cm
132128

@@ -142,19 +138,17 @@ def test_bar_colors(self):
142138
self._check_colors(ax.patches[::5], facecolors=rgba_colors)
143139
tm.close()
144140

145-
ax = df.loc[:, [0]].plot.bar(color="DodgerBlue")
146-
self._check_colors([ax.patches[0]], facecolors=["DodgerBlue"])
147-
tm.close()
148-
149-
ax = df.loc[:, [0]].plot.bar(c="DodgerBlue")
150-
self._check_colors([ax.patches[0]], facecolors=["DodgerBlue"])
151-
tm.close()
141+
for kw in ["c", "color"]:
142+
ax = df.loc[:, [0]].plot.bar(**{kw: "DodgerBlue"})
143+
self._check_colors([ax.patches[0]], facecolors=["DodgerBlue"])
144+
tm.close()
152145

153146
ax = df.plot(kind="bar", color="green")
154147
self._check_colors(ax.patches[::5], facecolors=["green"] * 5)
155148
tm.close()
156149

157-
def test_bar_user_colors(self):
150+
@pytest.mark.parametrize("kw", ["c", "color"])
151+
def test_bar_user_colors(self, kw):
158152
df = DataFrame(
159153
{"A": range(4), "B": range(1, 5), "color": ["red", "blue", "blue", "red"]}
160154
)

0 commit comments

Comments
 (0)