Matplotlib X-axis timezone trouble

Chris Angelico rosuav at gmail.com
Mon Jun 29 22:11:31 EDT 2015


On Tue, Jun 30, 2015 at 10:56 AM, Peter Pearson
<pkpearson at nowhere.invalid> wrote:
> The following code produces a plot with a line running from (9:30, 0) to
> (10:30, 1), not from (8:30, 0) to (9:30, 1) as I desire.
>
> pacific = pytz.timezone("US/Pacific")
> plt.plot([datetime.datetime(2014, 10, 7, 8, 30, tzinfo=pacific),
>           datetime.datetime(2014, 10, 7, 9, 30, tzinfo=pacific)],
>          [0,1], marker="o", color="green")

Sounds to me like a bug in DST handling - in October 2014, Los Angeles
was on Pacific Daylight Time, which would give a one-hour offset if
matplotlib is handling things on the basis of Pacific Standard Time. I
don't know if that helps at all with figuring out a solution, though.

ChrisA



More information about the Python-list mailing list