Skip to content
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

BUG: DataFrame.plot(subplots=True) results in extra ticks #39305

Open
2 of 3 tasks
kylekeppler opened this issue Jan 20, 2021 · 3 comments
Open
2 of 3 tasks

BUG: DataFrame.plot(subplots=True) results in extra ticks #39305

kylekeppler opened this issue Jan 20, 2021 · 3 comments
Assignees
Labels

Comments

@kylekeppler
Copy link
Contributor

kylekeppler commented Jan 20, 2021

  • 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.


Code Sample, a copy-pastable example

import pandas as pd
import numpy as np

df = pd.DataFrame(
    {
        'a': np.random.randint(100, size=100), 
        'b': np.random.randint(100, size=100), 
        'c': pd.date_range(start='1/1/2018', periods=100, freq='s'),
    }
)

axs = df.set_index(df['c'] + pd.to_timedelta(df['b'], unit='ms')).drop(columns='c').plot(subplots=True)
#[ax.minorticks_off() for ax in axs] # note uncomment this to work around issue

Problem description

When using DataFrame.plot with subplots=True, extra tick marks appear on the x axis.

issue

Expected Output

No extra ticks. Uncomment the line above to get the below:

workaround

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 9d598a5
python : 3.9.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.17763
machine : AMD64
processor : Intel64 Family 6 Model 142 Stepping 12, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 1.2.1
numpy : 1.19.5
pytz : 2020.5
dateutil : 2.8.1
pip : 20.3.3
setuptools : 49.6.0.post20210108
Cython : None
pytest : 6.2.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.3
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@kylekeppler kylekeppler added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 20, 2021
@simonjayhawkins simonjayhawkins added Visualization plotting and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 21, 2021
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Jan 21, 2021
@AnnaDaglis
Copy link
Contributor

Take

@AnnaDaglis
Copy link
Contributor

AnnaDaglis commented Jan 26, 2021

The undesired ticks are coming from this line of code

return ax.plot(*args, **kwds)
where we apply plot method on an object of class matplotlib.axes._subplots.AxesSubplot

@AnnaDaglis
Copy link
Contributor

AnnaDaglis commented Jan 27, 2021

@simonjayhawkins Would appreciate your advice on this! Since the issue seems to be coming from the logic in matplotlib library, should this issue be opened in matplotlib and we try to fix it there, rather than inside pandas?

@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants