Skip to content

Inconsistent color arguments #11228

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

Open
thomas-haslwanter opened this issue Oct 3, 2015 · 8 comments
Open

Inconsistent color arguments #11228

thomas-haslwanter opened this issue Oct 3, 2015 · 8 comments
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement Visualization plotting

Comments

@thomas-haslwanter
Copy link

In pandas 0.17.0.rc1 there is an inconsistency in the color arguments: once it is "color", other times it is "colors":

df.plot(kind='bar', color= ....)
df.plot(kind='pie', colors= ...)

@jreback
Copy link
Contributor

jreback commented Oct 3, 2015

hmm that seems wrong
want to do a pr to fix?

@thomas-haslwanter
Copy link
Author

Since I don't really know the code in pandas, I would prefer not to mess around with it. Also, I have to admit that I have close to zero experience with pr's.
Sorry :(

@sinhrks
Copy link
Member

sinhrks commented Oct 3, 2015

This was intentional to be compat with mpl (#6976).

I'm not sure which kwds should be used here.

  • Use color to minimize user code change, because other function uses color.
  • Use colors because pandas can generally accept multiple colors. MPL seems to use colors when they expect multiple input.

@TomAugspurger
Copy link
Contributor

Don't forget that we also accept c to refer to a column in scatter. It'd be nice to unify these someday.

@sumitbinnani
Copy link

@jreback @sinhrks
Is the suggested change suggested desired? I would like to give it a try.

Also, can we have both the parameters and implement using whichever is not None?

@sinhrks
Copy link
Member

sinhrks commented Oct 15, 2015

@sumitbinnani There is an existing logic to handle color and colors. pie, scatter and hexbin should use use the same method also.

https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py#L925

@sumitbinnani
Copy link

  • pie, ``scatterand hexbin` call the `init` of MPLPlot which in turn already calls `_validate_color_args`. However, in case of class `PiePlot`, the method `_validate_color_args` have been overridden. So, I guess, the issue might be resolved by removing the overridden method.
  • Also, _validate_color_args is overridden in BoxPlot and does not handle colors kwd. So, a deprecation warning might need to be included here.

Kindly correct me if the above changes does not meet the requirements, and something else needs to be taken care of, @sinhrks?

@sinhrks
Copy link
Member

sinhrks commented Oct 16, 2015

Looks OK.

One concern is MPL hexbin can accept color kw separately. It looks no effects, but pls check overwritting color kw in pandas side should not disturb any MPL use case.

http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.hexbin

@jbrockmendel jbrockmendel added the API - Consistency Internal Consistency of API/Behavior label Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement Visualization plotting
Projects
None yet
Development

No branches or pull requests

7 participants