Skip to content

BUG: warning when using colors 'CN' #36972

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
ivanovmg opened this issue Oct 8, 2020 · 0 comments · Fixed by #36981
Closed
2 of 3 tasks

BUG: warning when using colors 'CN' #36972

ivanovmg opened this issue Oct 8, 2020 · 0 comments · Fixed by #36981
Assignees
Labels
Testing pandas testing functions or related to the test suite Visualization plotting
Milestone

Comments

@ivanovmg
Copy link
Member

ivanovmg commented Oct 8, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd


df = pd.DataFrame(np.random.randn(10, 3), columns=["a", "b", "c"])
df.plot(color='C0')
plt.show()

Problem description

On master branch when executing the code above the following warning is raised.

workspaces/pandas/pandas/plotting/_matplotlib/style.py:64: MatplotlibDeprecationWarning: Support for uppercase single-letter colors is deprecated since Matplotlib 3.1 and will be removed in 3.3; please use lowercase instead.
  [conv.to_rgba(c) for c in colors]

Expected Output

Expected no warnings.

Related issue: #15516. The feature with "CN"-like colors was introduced in #15873.

I figured out that the problem lies in the line

        maybe_color_cycle = _maybe_valid_colors(list(colors))

So, if colors is "C0", then it is split into ["C", "0"].

I will fix it.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.8.3.final.0
python-bits : 32
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_United States.1251

pandas : 1.0.5
numpy : 1.19.0
pytz : 2020.1
dateutil : 2.8.1
pip : 19.2.3
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.2.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.5.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None

@ivanovmg ivanovmg added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 8, 2020
@ivanovmg ivanovmg self-assigned this Oct 8, 2020
@jreback jreback added this to the 1.2 milestone Oct 10, 2020
@jreback jreback added Testing pandas testing functions or related to the test suite Visualization plotting and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants