Closed
Description
Bug report
Bug summary
When plotting dates with time zone information on the x-axis, under certain circumstances, the wrong year will be displayed as the label.
Code for reproduction
import matplotlib.pyplot as plt
import pytz
from datetime import datetime, timedelta
x = [datetime(2010, 1, 1, tzinfo=pytz.timezone('America/New_York')) + timedelta(i) for i in range(2000)]
plt.plot(x, [0] * len(x));
Actual outcome
The first label on the plot is 2009.
Expected outcome
The first label on the plot is 2010.
Matplotlib version
Built this morning from master. Also confirmed the issue on 3.0.0 and confirmed that 2.2.2 does not have the issue (or at least not with the reproduction steps I found.)
- Operating system: Debian 7.11
- Matplotlib version: from source
- Matplotlib backend module://ipykernel.pylab.backend_inline
- Python version: 3.7.0
- Jupyter version (if applicable): 4.4.0
- Other libraries: pytz 2018.5
I built matplotlib from source to verify that this bug affects master. The checks against 3.0.0 and 2.2.2 were done on a conda install of those versions and may have had different versions of pytz and jupyter.