Skip to content

Commit 1616fb3

Browse files
MarcoGorelliphofl
andauthored
Backport PR Revert "Add color and size to arguments (#44856)" (#49752)
Co-authored-by: Patrick Hoefler <61934744+phofl@users.noreply.github.com>
1 parent 6f8e174 commit 1616fb3

File tree

5 files changed

+4
-19
lines changed

5 files changed

+4
-19
lines changed

doc/source/whatsnew/v1.5.0.rst

-1
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,6 @@ Plotting
11551155
- Bug in :meth:`DataFrame.boxplot` that prevented passing in ``xlabel`` and ``ylabel`` (:issue:`45463`)
11561156
- Bug in :meth:`DataFrame.boxplot` that prevented specifying ``vert=False`` (:issue:`36918`)
11571157
- Bug in :meth:`DataFrame.plot.scatter` that prevented specifying ``norm`` (:issue:`45809`)
1158-
- The function :meth:`DataFrame.plot.scatter` now accepts ``color`` as an alias for ``c`` and ``size`` as an alias for ``s`` for consistency to other plotting functions (:issue:`44670`)
11591158
- Fix showing "None" as ylabel in :meth:`Series.plot` when not setting ylabel (:issue:`46129`)
11601159
- Bug in :meth:`DataFrame.plot` that led to xticks and vertical grids being improperly placed when plotting a quarterly series (:issue:`47602`)
11611160
- Bug in :meth:`DataFrame.plot` that prevented setting y-axis label, limits and ticks for a secondary y-axis (:issue:`47753`)

doc/source/whatsnew/v1.5.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Bug fixes
3434

3535
Other
3636
~~~~~
37-
-
37+
- Reverted ``color`` as an alias for ``c`` and ``size`` as an alias for ``s`` in function :meth:`DataFrame.plot.scatter` (:issue:`49732`)
3838
-
3939

4040
.. ---------------------------------------------------------------------------

pandas/plotting/_core.py

-9
Original file line numberDiff line numberDiff line change
@@ -1643,11 +1643,6 @@ def scatter(self, x, y, s=None, c=None, **kwargs) -> PlotAccessor:
16431643
16441644
.. versionchanged:: 1.1.0
16451645
1646-
size : str, scalar or array-like, optional
1647-
Alias for s.
1648-
1649-
.. versionadded:: 1.5.0
1650-
16511646
c : str, int or array-like, optional
16521647
The color of each point. Possible values are:
16531648
@@ -1661,10 +1656,6 @@ def scatter(self, x, y, s=None, c=None, **kwargs) -> PlotAccessor:
16611656
16621657
- A column name or position whose values will be used to color the
16631658
marker points according to a colormap.
1664-
color : str, int or array-like, optional
1665-
Alias for c.
1666-
1667-
.. versionadded:: 1.5.0
16681659
16691660
**kwargs
16701661
Keyword arguments to pass on to :meth:`DataFrame.plot`.

pandas/tests/plotting/frame/test_frame.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
""" Test cases for DataFrame.plot """
12
from datetime import (
23
date,
34
datetime,
@@ -658,11 +659,6 @@ def test_plot_scatter(self):
658659
with pytest.raises(TypeError, match=msg):
659660
df.plot.scatter(y="y")
660661

661-
with pytest.raises(TypeError, match="Specify exactly one of `s` and `size`"):
662-
df.plot.scatter(x="x", y="y", s=2, size=2)
663-
with pytest.raises(TypeError, match="Specify exactly one of `c` and `color`"):
664-
df.plot.scatter(x="a", y="b", c="red", color="green")
665-
666662
# GH 6951
667663
axes = df.plot(x="x", y="y", kind="scatter", subplots=True)
668664
self._check_axes_shape(axes, axes_num=1, layout=(1, 1))

pandas/tests/plotting/frame/test_frame_color.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,14 @@ def test_if_scatterplot_colorbars_are_next_to_parent_axes(self):
196196
assert np.isclose(parent_distance, colorbar_distance, atol=1e-7).all()
197197

198198
@pytest.mark.parametrize("cmap", [None, "Greys"])
199-
@pytest.mark.parametrize("kw", ["c", "color"])
200-
def test_scatter_with_c_column_name_with_colors(self, cmap, kw):
199+
def test_scatter_with_c_column_name_with_colors(self, cmap):
201200
# https://github.com/pandas-dev/pandas/issues/34316
202201
df = DataFrame(
203202
[[5.1, 3.5], [4.9, 3.0], [7.0, 3.2], [6.4, 3.2], [5.9, 3.0]],
204203
columns=["length", "width"],
205204
)
206205
df["species"] = ["r", "r", "g", "g", "b"]
207-
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"})
206+
ax = df.plot.scatter(x=0, y=1, cmap=cmap, c="species")
208207
assert ax.collections[0].colorbar is None
209208

210209
def test_scatter_colors(self):

0 commit comments

Comments
 (0)