-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Add 'color' and 'size' to arguments #44856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
2f54813
3feaabc
68f2551
390fc86
865b7ac
1f30d45
543c64e
d1fd7bc
eda1fbc
1caf4dc
021aadd
5e94951
05a26c8
f7b833c
f99424e
abf377e
33c1ca5
f131fe4
e6ac538
c9d6043
757f292
53503ce
73e3fb1
e17db52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1127,6 +1127,16 @@ def bar(self, x=None, y=None, **kwargs): | |
axis of the plot shows the specific categories being compared, and the | ||
other axis represents a measured value. | ||
""" | ||
c = kwargs.pop("c", None) | ||
color = kwargs.pop("color", None) | ||
if c is not None and color is not None: | ||
raise TypeError("Specify exactly one of `c` and `color`") | ||
if c is not None or color is not None: | ||
if color is not None: | ||
kwargs.setdefault("color", color) | ||
else: | ||
kwargs.setdefault("color", c) | ||
|
||
return self(kind="bar", x=x, y=y, **kwargs) | ||
|
||
@Appender( | ||
|
@@ -1213,6 +1223,16 @@ def barh(self, x=None, y=None, **kwargs): | |
axis of the plot shows the specific categories being compared, and the | ||
other axis represents a measured value. | ||
""" | ||
c = kwargs.pop("c", None) | ||
color = kwargs.pop("color", None) | ||
if c is not None and color is not None: | ||
raise TypeError("Specify exactly one of `c` and `color`") | ||
if c is not None or color is not None: | ||
if color is not None: | ||
kwargs.setdefault("color", color) | ||
else: | ||
kwargs.setdefault("color", c) | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return self(kind="barh", x=x, y=y, **kwargs) | ||
|
||
def box(self, by=None, **kwargs): | ||
|
@@ -1582,7 +1602,7 @@ def pie(self, **kwargs): | |
raise ValueError("pie requires either y column or 'subplots=True'") | ||
return self(kind="pie", **kwargs) | ||
|
||
def scatter(self, x, y, s=None, c=None, **kwargs): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can deprecate but not rename as that is a breaking change these are matpotlib names but not objecting to the change per se There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your point but I need some help to solve it. What is best practice in this situation and how does a deprication warning work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mosc9575 check some other PRs which deprecate arguments for examples https://github.com/pandas-dev/pandas/pulls?q=is%3Apr+depr+is%3Amerged+ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback I used the wrong word. I did not "rename", I added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't keep both in the signature, that'd be confusing I'd suggest:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MarcoGorelli Thank you. I go with your suggestions. I will edit my PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks - will also need tests to cover the new behaviour |
||
def scatter(self, x, y, **kwargs): | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
Create a scatter plot with varying marker point size and color. | ||
|
||
|
@@ -1665,7 +1685,27 @@ def scatter(self, x, y, s=None, c=None, **kwargs): | |
... c='species', | ||
... colormap='viridis') | ||
""" | ||
return self(kind="scatter", x=x, y=y, s=s, c=c, **kwargs) | ||
s = kwargs.pop("s", None) | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
size = kwargs.pop("size", None) | ||
if s is not None and size is not None: | ||
raise TypeError("Specify exactly one of `s` and `size`") | ||
MarcoGorelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if s is not None or size is not None: | ||
if s is not None: | ||
kwargs.setdefault("s", s) | ||
else: | ||
kwargs.setdefault("s", size) | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
c = kwargs.pop("c", None) | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
color = kwargs.pop("color", None) | ||
if c is not None and color is not None: | ||
raise TypeError("Specify exactly one of `c` and `color`") | ||
if c is not None or color is not None: | ||
if c is not None: | ||
kwargs.setdefault("c", c) | ||
else: | ||
kwargs.setdefault("c", color) | ||
attack68 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return self(kind="scatter", x=x, y=y, **kwargs) | ||
|
||
def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None, **kwargs): | ||
""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.