I am trying to plot some datetime data but I have two problems I can't solve. My code is the following:
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from datetime import datetime as DT
import numpy as np
%matplotlib inline
dt = np.dtype([('date', 'datetime64[D]'), ('count', np.uint32)])
data = np.array([(np.datetime64('2014-12-' + str(i)), i) for i in range(11,20)], dtype=dt)
fig, ax = plt.subplots(figsize=(18,8), dpi=300)
ax.plot_date(data['date'], data['count'])
#ax.set_xlim( [mdates.date2num( (data['date'][0] - np.timedelta64(1, 'D')).astype(DT) ),
mdates.date2num( (data['date'][-1] + np.timedelta64(1, 'D')).astype(DT) )]);
With the last line commented out I get a plot but with the x labels shifted to the right of 1 day.

When I try to set the x limits to the day before the first day of the data and to the day after the last day of the data the limits are correctly setted but I lose the data points

dec 10 45in the x-axis for example? Why the 45? Are you sure yourdata[date]is the correct date?np.datetime64('2014-12-10')it changes the year?