-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Plotly scatter plots no longer produce color correctly, color alias for c in 1.5 #49732
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
That's a good point, thanks @astrowonk It may be best to revert the PR that introduced the alias |
Thanks for reporting this @astrowonk and for looking into it @MarcoGorelli! As the author of the I had to add some code to adapt the kwarg lists for various |
Hey @nicolaskruchten
No no, this is totally my fault for having approved https://github.com/pandas-dev/pandas/pull/44856/files . In fact, I should've rejected the issue instead of encouraging a PR. I wasn't thinking about the plotly backend because I don't use it (I use plotly directly by importing plotly and plotly.express) Going forwards, something I've had on the back of my mind is to suggest to the rest of the pandas dev team is to declare pandas.plotting as being in "maintenance mode" only (my personal preference would be to remove most of it completely, as I think Either way, you shouldn't need to worry about breaking changes in pandas.plotting. Regarding what to do about this specific issue, I'll look into solutions more carefully later this week |
@MarcoGorelli I would just say that I have made extensive use of the pandas plotting back end syntax (albeit lately with plotly and the backend). I think it's important to keep so existing code keeps working with existing backends. Were it to vanish, so many scripts and modules I have written would break, so whatever happens, please keep the |
Thanks @astrowonk , that's a useful perspective I was thinking more about all the custom matplotlib code in pandas, as that's what causes the most issues - it could be greatly simplified, like with an entrypoint in seaborn similar to the one in plotly. I'll flesh that out in a separate issue anyway |
I find it very useful in ad hoc data analysis to be able to do Edit:
Ah, I should have read further before posting. +1 here. |
Yeah my feeling is that the existing functionality can never go away... Maintenance mode sounds good to me though! |
Finally got round to it - here's my proposal: #50059 |
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
Issue Description
Plotly (and perhaps other backends) take a color argument that is a column name to use to make distinct colors for each variable (or even continuous color.) This is very convenient compared to the
c
variable in the pandas backend that takes a list of colors.In Pandas 1.5,
color
andc
in the back end code become the same, or rathercolor
is an alias ofc
:In addition, the code pops out the
color
argument so that it no longer exists inkwargs
so the color information (expected to be a list of columns) is now absent. Changing the line towould leave the variable in place, but then other plotting back ends would get color and presumably crash on an expected keyword, and would have to use
c
instead.I think it would be best to not alias
color
toc
for scatter plots and let backends likeplotly
continue to work as they did prior to 1.5.xExpected Behavior
Plotly
color
kwarg should behave as expected prior to 1.5.x and pass through a column name to the plotly backend, not remove the kwarg and alias it to thec
kwarg.Installed Versions
/usr/local/opt/miniforge3/lib/python3.10/site-packages/_distutils_hack/init.py:33: UserWarning:
Setuptools is replacing distutils.
INSTALLED VERSIONS
commit : 91111fd
python : 3.10.6.final.0
python-bits : 64
OS : Darwin
OS-release : 22.1.0
Version : Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.5.1
numpy : 1.23.4
pytz : 2022.1
dateutil : 2.8.2
setuptools : 65.5.1
pip : 22.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.6.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
brotli :
fastparquet : None
fsspec : 2022.5.0
gcsfs : None
matplotlib : 3.5.3
numba : 0.56.3
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 9.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.0
snappy : None
sqlalchemy : 1.4.44
tables : None
tabulate : 0.8.10
xarray : None
xlrd : 2.0.1
xlwt : None
zstandard : None
tzdata : 2022.6
The text was updated successfully, but these errors were encountered: