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
When plotting datetime values using date2num, something strange happens around the hour of daylight switching (matplotlib 1.4.2, pandas 0.15.1, numpy 1.9.1) as shown in the following graph:
import matplotlib.pyplot as plt
import datetime as dt
import pandas as pd
import pytz
from matplotlib.dates import date2num
dt64_utc = pd.date_range(start='2014/03/29 22:00', end='2014/03/30 6:00', freq='min', tz='UTC')
dtmpl_utc = date2num(dt64_utc.astype(dt.datetime))
dt64_bxl = dt64_utc.tz_convert(pytz.timezone('Europe/Brussels'))
dtmpl_bxl = date2num(dt64_bxl.astype(dt.datetime))
dtmpl_bxl_utc = date2num(dt64_bxl.tz_convert('UTC').astype(dt.datetime))
plt.plot(dtmpl_utc, dtmpl_bxl, 'g', label='implicit conversion to UTC by date2num')
plt.plot(dtmpl_utc, dtmpl_bxl_utc, 'b--', label='explicit conversion to UTC before calling date2num')
plt.gca().xaxis_date()
plt.gca().yaxis_date()
plt.grid()
plt.legend()
I assume this is a bug in date2num?
The text was updated successfully, but these errors were encountered:
When plotting datetime values using date2num, something strange happens around the hour of daylight switching (matplotlib 1.4.2, pandas 0.15.1, numpy 1.9.1) as shown in the following graph:
I assume this is a bug in date2num?
The text was updated successfully, but these errors were encountered: