Open
Description
Bug summary
When you make a plot with the ConciseDateFormatter
that shows on the x axis days and months the offset_string
also shows the month (with the year) which I think is redundant because you only need the year
Code for reproduction
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
fig, ax = plt.subplots()
d1 = datetime.datetime(1997, 1, 1)
d2 = d1 + datetime.timedelta(weeks=520)
locator = mdates.AutoDateLocator()
formatter = mdates.ConciseDateFormatter(locator)
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(formatter)
ax.plot([d1, d2], [0, 0])
ax.set_xlim(d1, d1 + datetime.timedelta(weeks=3))
ax.set_xlim(d1 + datetime.timedelta(weeks=1),
d1 + datetime.timedelta(weeks=10))
plt.show()
Actual outcome
Expected outcome
Additional information
When the ConciseDateFormatter
was proposed here you can see the same expected behavior:
Operating system
Ubuntu 22.04.1 LTS
Matplotlib Version
3.6.2
Matplotlib Backend
agg
Python version
3.10.6
Jupyter version
No response
Installation
pip