You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rotation is done on purpose, as you would otherwise get overlapping labels (like in your second example plot, only without the non-centered labels).
So there are two ways pandas plots datetimes under the hood: ones with a regular frequence, and the ones without regular frequency (that is the reason you see a difference for frames with a different freq). The problem is that only for the regular time series, we have custom label formatting (your third plot). For the non-regular, we just use matplotlib default formatting, with this difference that we apply a rotation by default to have non-overlapping labels.
See #15071 for a longer explanation.
The shift in the labels (non-centered) when using rot=0 is a bit annoying.
Thanks for the explanation (personally, I am in favour of passing all plots in period base plotting, it looks nicer).
The shift in the labels (non-centered) when using rot=0 is a bit annoying.
I spoted the problem in format_date_labels:
defformat_date_labels(ax, rot):
# mini version of autofmt_xdatetry:
forlabelinax.get_xticklabels():
label.set_ha('right') # here is the problemlabel.set_rotation(rot)
fig=ax.get_figure()
fig.subplots_adjust(bottom=0.2)
exceptException: # pragma: no coverpass
with rot=0 the alignement should be center. However I have no idea how to solve it.
I think it's a feature (having the end of the labels on the ticks), however it is a bit confusing without rotation.
Code Sample
Problem description
When plotting a time indexed series, we expect no rotation in x labels. It does not work when importing data with
where the rotation occurs. Moreover, set
rot=0
gives a strange behavior with label not centered on ticks.The only difference is that
freq=None
in the first case.Expected Output
No rotation by default.
Here is what we have for

df1.plot()
(Problem) :Here is what we have for

df1.plot(rot=0)
(Problem) :Here is what we have for

df2.plot()
(Ok) :Details
May be related to :
pandas: 0.19.2
nose: None
pip: None
setuptools: 34.2.0
Cython: None
numpy: 1.12.0
scipy: 0.18.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: 0.10.3
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: