Skip to content

BUG: DataFrame.plot(kind='scatter') does not raise KeyError when unknown colormap is applied #48726

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

Closed
2 of 3 tasks
lisphilar opened this issue Sep 23, 2022 · 2 comments · Fixed by #48734
Closed
2 of 3 tasks
Labels
Regression Functionality that used to work in a prior pandas version Visualization plotting
Milestone

Comments

@lisphilar
Copy link

lisphilar commented Sep 23, 2022

Pandas version checks

  • 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 main branch of pandas.

Reproducible Example

import pandas as pd
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
iris.plot(x='sepal_length', y='sepal_width', colormap='unknown')
# -> TypeError raised as expected
iris.plot(x='sepal_length', y='sepal_width', colormap='unknown', kind='scatter')
# -> TypeError is expected but not raised at version 1.5.0

Issue Description

.plot(..., colormap='unknown') raises TypeError because the colormap is unknown, but .plot(..., colormap='unknown', kind='scatter') does raise TypeError.

Expected Behavior

.plot(..., cmap='unknown', kind='scatter') will raise TypeError.

Installed Versions

INSTALLED VERSIONS

commit : 87cfe4e
python : 3.10.7.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.16.3-microsoft-standard-WSL2
Version : #1 SMP Fri Apr 2 22:23:49 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 65.3.0
pip : 22.2.2
Cython : None
pytest : 7.1.3
hypothesis : None
sphinx : 5.1.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.5.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 9.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.1
snappy : None
sqlalchemy : 1.4.41
tables : None
tabulate : 0.8.10
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None

@lisphilar lisphilar added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 23, 2022
@phofl phofl added Visualization plotting Regression Functionality that used to work in a prior pandas version and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels Sep 23, 2022
@phofl phofl added this to the 1.5.1 milestone Sep 23, 2022
@phofl
Copy link
Member

phofl commented Sep 23, 2022

This will raise a Waring with the newest matplotlib, since colormap has no effect in that scenario, even if a valid value is passed

@lisphilar
Copy link
Author

Thank you for your information and pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants