-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Pandas plot does not accept Columns for color keyword #44670
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
Comments
This is mentioned as a workaround in #40605. |
Is that documented anywhere? If not, I'd consider this as a feature request rather than a bug Actually, the docs say
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.scatter.html Does it work with |
Yes, the line |
Yes, it is inconsistent - I can't think of why I think I'd suggest to allow users to pass |
Yes, I'll come back and give a PR a try. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
I tried to plot a scatterplot with different groups, with one color for each group. I thought is is enought to pass the name of the column to the color-keyword, but this throws an error:
ValueError: 'c' argument must be a color, a sequence of colors, or a sequence of numbers, not ['color']
Expected Behavior
I expect this figure, which was generated using the commented line
s.plot(x='A', y='B', kind='scatter', color=s['color'].values)
Installed Versions
pandas : 1.3.4
numpy : 1.20.3
pytz : 2021.1
dateutil : 2.8.2
pip : 21.2.4
setuptools : 58.0.4
Cython : 0.29.24
pytest : 6.2.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : 7.28.0
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 2021.09.0
fastparquet : None
gcsfs : None
matplotlib : 3.4.3
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.1
sqlalchemy : 1.4.23
tables : 3.6.1
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : 0.54.0
1
The text was updated successfully, but these errors were encountered: