Skip to content

No labels on X-axis on charts with secondary_y=True #14102

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
dmage opened this issue Aug 27, 2016 · 4 comments · Fixed by #60294
Closed

No labels on X-axis on charts with secondary_y=True #14102

dmage opened this issue Aug 27, 2016 · 4 comments · Fixed by #60294
Assignees
Labels
Bug Needs Tests Unit test(s) needed to prevent regressions Visualization plotting

Comments

@dmage
Copy link

dmage commented Aug 27, 2016

Code Sample, a copy-pastable example if possible

#!/usr/bin/env python3
import matplotlib.pyplot as plt
import pandas as pd

# some data
s1 = pd.Series(data=[5,7,6,8,7], index=[1,2,3,4,5])
s2 = pd.Series(data=[6,4,5,3,4], index=[1,2,3,4,5])

ax = plt.subplot(2, 1, 1)
s1.plot(ax=ax)
s2.plot(ax=ax, secondary_y=True)

assert len(ax.xaxis.get_minor_ticks()) == 0

ax2 = plt.subplot(2, 1, 2)
#s1.plot(ax=ax2)  # uncomment me

assert len(ax.xaxis.get_minor_ticks()) == 0

plt.show()

Expected Output

Labels on x-axis (no minor ticks).
Plotting on ax2 not affects ax.

output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Darwin
OS-release: 15.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: ru_RU.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 23.1.0
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
@jreback jreback added the Visualization plotting label Aug 28, 2016
@jorisvandenbossche
Copy link
Member

@dmage Thanks for the report!
I think pandas removed the ticklabels when the axes are shared (when you create multiple subplots at once from a pandas dataframe), but that is not the case here, so the labels should be kept. Marked as a bug.

@rhshadrach
Copy link
Member

This appears to be fixed. Could use a test.

@rhshadrach rhshadrach added the Needs Tests Unit test(s) needed to prevent regressions label Nov 5, 2024
@jasonmokk
Copy link
Contributor

take

@jasonmokk jasonmokk removed their assignment Nov 8, 2024
@jasonmokk
Copy link
Contributor

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Tests Unit test(s) needed to prevent regressions Visualization plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants