-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Scatterplot x-axis label disappears with colorscale when using matplotlib backend #36064
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
Is this limited to the inline notebook backend? Can you figure out which version / commit introduced the regression? |
.24 reintroduced according to someone in the other issue thread.
Not sure if just in the notebook but will check when I can.
…On Fri, Sep 4, 2020, 7:07 AM Tom Augspurger ***@***.***> wrote:
Is this limited to the inline notebook backend?
Can you figure out which version / commit introduced the regression?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#36064 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2Y3GLOREV2QGCWWE2VXHTSEDC5ZANCNFSM4QS44KCQ>
.
|
I have tested with file output @TomAugspurger and can confirm that the bug is present there as well. import matplotlib.cm as cm
import pandas as pd
import numpy as np
X = np.random.rand(10,3)
df = pd.DataFrame(X,columns=['t','hlReference', 'STEP_STRENGTH'])
fig = df.plot(
kind='scatter',
x='t',
y='hlReference',
c='STEP_STRENGTH',
cmap=cm.autumn,
).get_figure()
fig.savefig('test') |
#10611 definitely seems to be back. Here is a minimal example: import pandas as pd
df = pd.DataFrame([1,2,3])
# has x labels:
df.plot(kind = "scatter", x = 0, y = 0)
# does not have x labels:
df.plot(kind = "scatter", x = 0, y = 0, c = 0) That was shown in the Spyder plot pane, but I get the same result when saving to file: fig = df.plot(kind = "scatter", x = 0, y = 0, c = 0).get_figure()
fig.savefig('test') Currently using pandas 1.1.5 (and matplotlib 3.3.3) |
I see the same behavior on pandas 1.3.0. Can we at least get a milestone assignment? |
@igurin-invn you or anyone in the community can submit a PR at anytime pandas core can barely keep up with reviews - issues are assigned a milestone when their is a PR |
This seems to be fixed in
I really dislike the default colourmap because it results in invisible points, but the x-axis label is there at least. If someone can confirm then I think this issue can be closed. |
As a workaround setting sharex=False might help. |
|
This issue was reported and resolved in xticks missing for scatter plots with colors #10611 but returned with 0.24.0.
I have confirmed this bug exists on the latest version 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
Problem description
X-axis label disappears when you add a colorscale to a scatterplot when using matplotlib backend.
UPDATE confirmed this bug occurs in Jupyter and when files are written out
Example taken from this SO question that also shows the two workarounds.
Workaround 1: Get an ax object and pass
ax=ax
.Workaround 2: Pass
sharex=False
A previous solution to the problem is discussed in closed issue #10611, but it appears that stopped working in 0.24.0.
Expected Output
Show the x-axis label.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : d9fff27
python : 3.7.6.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
Version : Darwin Kernel Version 18.7.0: Thu Jun 18 20:50:10 PDT 2020; root:xnu-4903.278.43~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.0
numpy : 1.18.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.2
setuptools : 49.6.0.post20200814
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : 4.9.1
bottleneck : 1.3.2
fsspec : 0.7.4
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.1
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.16.0
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
numba : 0.50.0
The text was updated successfully, but these errors were encountered: