-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pandas plotting raises ValueError on style strings that should be valid according to spec. #21003
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
I think this can be solved by changing the regex at |
By Pandas 1.0.2 the issue has been partly fixed and the code sample runs fine now. However the same problem still persists when passing a list of colors as illustrated in the code sample below.
This can be fixed by changing pandas/plotting/matplotlib/core.py in the
to
However, a real solution should pull the color letters from By the way, I'm the same guy as Austrianguy. E-mail inboxes sometimes disappear. And passwords are forgotten. |
I'm working on the bug fix. However I ran into the following issue when writing the test cases. The code above only fails during rendering. I included my code from 2018-05-10 and 2020-04-23 as tests in Here's the traceback from running my 2020 code (copied from above) directly in Spyder:
|
related PR that was supposed to fix these issues: #29122 |
Code Sample
Full Stack Trace
Problem description
df.plot
should just pass thestyle
kwarg asfmt
arg tomatplotlib.axes.plot
but it does does some extra (sloppy) validation where it thinks that valid marker style symbols are color symbols and raises an error if the color is already defined elsewhere. The problem is clearly in_core.py
, line 213.This problem affects the following standard marker styles (key corresponds to
m
in the example code):Expected Output
df.plot(color='green', style=fmt)
should simply plot the plot the same way asplt.plot(data, fmt, color='green')
without raising errors. All legal values forfmt
arg inpyplot.plot
should be legal for thestyle
kwarg indf.plot
.Output of
pd.show_versions()
pandas: 0.22.0
pytest: 3.5.0
pip: 9.0.3
setuptools: 39.0.1
Cython: 0.28.2
numpy: 1.14.2
scipy: 1.0.1
pyarrow: None
xarray: None
IPython: 5.6.0
sphinx: 1.7.2
patsy: 0.5.0
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.2.2
openpyxl: 2.5.2
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.4
lxml: 4.2.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.6
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: