Skip to content

Commit

Permalink
Backport PR Revert "Add color and size to arguments (#44856)" (#49752)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Hoefler <[email protected]>
  • Loading branch information
MarcoGorelli and phofl authored Nov 17, 2022
1 parent 6f8e174 commit 1616fb3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion doc/source/whatsnew/v1.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.5.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
-

.. ---------------------------------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,11 +1643,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:
Expand All @@ -1661,10 +1656,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`.
Expand Down
6 changes: 1 addition & 5 deletions pandas/tests/plotting/frame/test_frame.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
""" Test cases for DataFrame.plot """
from datetime import (
date,
datetime,
Expand Down Expand Up @@ -658,11 +659,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))
Expand Down
5 changes: 2 additions & 3 deletions pandas/tests/plotting/frame/test_frame_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,14 @@ 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(
[[5.1, 3.5], [4.9, 3.0], [7.0, 3.2], [6.4, 3.2], [5.9, 3.0]],
columns=["length", "width"],
)
df["species"] = ["r", "r", "g", "g", "b"]
ax = df.plot.scatter(x=0, y=1, cmap=cmap, **{kw: "species"})
ax = df.plot.scatter(x=0, y=1, cmap=cmap, c="species")
assert ax.collections[0].colorbar is None

def test_scatter_colors(self):
Expand Down

0 comments on commit 1616fb3

Please sign in to comment.