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

xticks unnecessarily rotated #29460

Closed
thehalftruth opened this issue Nov 7, 2019 · 1 comment · Fixed by #34334
Closed

xticks unnecessarily rotated #29460

thehalftruth opened this issue Nov 7, 2019 · 1 comment · Fixed by #34334
Assignees
Labels
Milestone

Comments

@thehalftruth
Copy link

Code Sample

import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO

csv_string = """x,y1,y2
0, 1, 1
1, 1, 2
2, 1, 3
3, 4, 2
4, 2, 4
5, 3, 3
"""

data = pd.read_csv(StringIO(csv_string))
dataframe = pd.DataFrame(data)

dataframe.plot(x="x",
               y=["y1", "y2"],
               kind="line",
               subplots=True,
               sharex=True,
               marker=",",
               linewidth=0.5,
               title="Title"
               )

plt.show()

Problem description

The xticks are unnecessarily rotated:
grafik
Also the title overlaps the subplot, but I will create a new issue for that.

Expected Output

The xticks shouldn't be rotated.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : None python : 3.7.2.final.0 python-bits : 32 OS : Windows OS-release : 10 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : None.None

pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 41.6.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
import sys; print('Python %s on %s' % (sys.version, sys.platform))
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32

@jbrockmendel jbrockmendel added the Visualization plotting label Nov 7, 2019
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Apr 1, 2020
@MarcoGorelli
Copy link
Member

MarcoGorelli commented May 22, 2020

Thanks @thehalftruth for the report

Seems this only happens when subplots=True

also happens when use_index=False and the index is all dates

notes to self:

historical work was done in pandas/tools/plotting.py. also, see #8301

@MarcoGorelli MarcoGorelli self-assigned this May 22, 2020
@jreback jreback modified the milestones: Contributions Welcome, 1.2 Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants