From 961005abd4b56084784379024b547b65346cb0ba Mon Sep 17 00:00:00 2001 From: Patrick Hoefler <61934744+phofl@users.noreply.github.com> Date: Thu, 17 Nov 2022 19:33:42 +0100 Subject: [PATCH] Revert "Add 'color' and 'size' to arguments (#44856)" (#49734) * Revert "Add 'color' and 'size' to arguments (#44856)" This reverts commit 8a4abfa587af150ac8f67d640b8e530fa0ba90f3. # Conflicts: # doc/source/whatsnew/v1.5.0.rst # pandas/plotting/_core.py # pandas/tests/plotting/frame/test_frame_color.py * Add whatsnew --- doc/source/whatsnew/v1.5.0.rst | 1 - doc/source/whatsnew/v1.5.2.rst | 2 +- pandas/plotting/_core.py | 9 --------- pandas/tests/plotting/frame/test_frame.py | 6 +----- pandas/tests/plotting/frame/test_frame_color.py | 7 +++---- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 08dbb357c8053..a1c374db91f8b 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -1155,7 +1155,6 @@ Plotting - Bug in :meth:`DataFrame.boxplot` that prevented passing in ``xlabel`` and ``ylabel`` (:issue:`45463`) - Bug in :meth:`DataFrame.boxplot` that prevented specifying ``vert=False`` (:issue:`36918`) - Bug in :meth:`DataFrame.plot.scatter` that prevented specifying ``norm`` (:issue:`45809`) -- 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`) - Fix showing "None" as ylabel in :meth:`Series.plot` when not setting ylabel (:issue:`46129`) - Bug in :meth:`DataFrame.plot` that led to xticks and vertical grids being improperly placed when plotting a quarterly series (:issue:`47602`) - Bug in :meth:`DataFrame.plot` that prevented setting y-axis label, limits and ticks for a secondary y-axis (:issue:`47753`) diff --git a/doc/source/whatsnew/v1.5.2.rst b/doc/source/whatsnew/v1.5.2.rst index 540ca2b12165c..dd909415d9e85 100644 --- a/doc/source/whatsnew/v1.5.2.rst +++ b/doc/source/whatsnew/v1.5.2.rst @@ -34,7 +34,7 @@ Bug fixes Other ~~~~~ -- +- Reverted ``color`` as an alias for ``c`` and ``size`` as an alias for ``s`` in function :meth:`DataFrame.plot.scatter` (:issue:`49732`) - .. --------------------------------------------------------------------------- diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index da6c1ad47d2dd..529849e740169 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -1630,11 +1630,6 @@ def scatter(self, x, y, s=None, c=None, **kwargs) -> PlotAccessor: .. versionchanged:: 1.1.0 - size : str, scalar or array-like, optional - Alias for s. - - .. versionadded:: 1.5.0 - c : str, int or array-like, optional The color of each point. Possible values are: @@ -1648,10 +1643,6 @@ def scatter(self, x, y, s=None, c=None, **kwargs) -> PlotAccessor: - A column name or position whose values will be used to color the marker points according to a colormap. - color : str, int or array-like, optional - Alias for c. - - .. versionadded:: 1.5.0 **kwargs Keyword arguments to pass on to :meth:`DataFrame.plot`. diff --git a/pandas/tests/plotting/frame/test_frame.py b/pandas/tests/plotting/frame/test_frame.py index 73b723ba7f597..06f9ffd2bb23a 100644 --- a/pandas/tests/plotting/frame/test_frame.py +++ b/pandas/tests/plotting/frame/test_frame.py @@ -1,3 +1,4 @@ +""" Test cases for DataFrame.plot """ from datetime import ( date, datetime, @@ -652,11 +653,6 @@ def test_plot_scatter(self): with pytest.raises(TypeError, match=msg): df.plot.scatter(y="y") - with pytest.raises(TypeError, match="Specify exactly one of `s` and `size`"): - df.plot.scatter(x="x", y="y", s=2, size=2) - with pytest.raises(TypeError, match="Specify exactly one of `c` and `color`"): - df.plot.scatter(x="a", y="b", c="red", color="green") - # GH 6951 axes = df.plot(x="x", y="y", kind="scatter", subplots=True) self._check_axes_shape(axes, axes_num=1, layout=(1, 1)) diff --git a/pandas/tests/plotting/frame/test_frame_color.py b/pandas/tests/plotting/frame/test_frame_color.py index ed129d315a0c6..925d9ca9e2fa2 100644 --- a/pandas/tests/plotting/frame/test_frame_color.py +++ b/pandas/tests/plotting/frame/test_frame_color.py @@ -196,8 +196,7 @@ def test_if_scatterplot_colorbars_are_next_to_parent_axes(self): assert np.isclose(parent_distance, colorbar_distance, atol=1e-7).all() @pytest.mark.parametrize("cmap", [None, "Greys"]) - @pytest.mark.parametrize("kw", ["c", "color"]) - def test_scatter_with_c_column_name_with_colors(self, cmap, kw): + def test_scatter_with_c_column_name_with_colors(self, cmap): # https://github.com/pandas-dev/pandas/issues/34316 df = DataFrame( @@ -207,9 +206,9 @@ def test_scatter_with_c_column_name_with_colors(self, cmap, kw): df["species"] = ["r", "r", "g", "g", "b"] if cmap is not None: with tm.assert_produces_warning(UserWarning, check_stacklevel=False): - ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"}) + ax = df.plot.scatter(x=0, y=1, cmap=cmap, c="species") else: - ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"}) + ax = df.plot.scatter(x=0, y=1, c="species", cmap=cmap) assert ax.collections[0].colorbar is None def test_scatter_colors(self):