X Tutup
Skip to content

figure.Figure.autofmt_xdate applied to major xtick labels only #8128

@gitporst

Description

@gitporst

Bug summary
The autofmt_xdate of the figure.Figure class by default only formats the major tick labels. Increased functionality including the minor ticks as well would be nice.

Code for reproduction

import pandas as pd
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

df = pd.DataFrame(data=[1] * 5,
                  index=pd.date_range(start='2017-01-01', periods=5),
                  columns=['A'])
df.plot(ax=ax)
fig.autofmt_xdate()
plt.show()

Actual outcome
autofmt_xdate_issue

Expected outcome
It would be nice, if autofmt_xdate would be applied to the minor labels as well. This could be achieved, for example, by adding the keyword arg which='major' to autofmt_xdate, which will in turn be passed to each call of ax.get_xticklabels(). The user could then select which='both', if wanted.

Matplotlib version

commit: None
python: 2.7.10.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 23 Stepping 10, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.19.2
setuptools: 27.1.2
matplotlib: 1.5.1
...
although using matplotlib 1.5.1, the issue persists in the current master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesNew feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup