Plot numpy datetime64 with matplotlib

from datetime import datetime
a=np.datetime64('2002-06-28').astype(datetime)
plot_date(a,2)

Matplotlib>=2.2 natively supports plotting datetime64 arrays. See https://github.com/matplotlib/matplotlib/blob/master/doc/users/prev_whats_new/whats_new_2.2.rst#support-for-numpydatetime64:

Matplotlib has supported datetime.datetime dates for a long time in matplotlib.dates. We now support numpy.datetime64 dates as well. Anywhere that dateime.datetime could be used, numpy.datetime64 can be used. eg:

time = np.arange('2005-02-01', '2005-02-02', dtype='datetime64[h]')
plt.plot(time)

You might want to try this:

plot_date(timeSeries, data)

By default, the x axis will be considered a date axis, and y a regular one. This can be customized.