Matlab pcolor datetime

Matlab datetime was one of many important features added in Matlab R2014b. However, at least through Matlab R2018b, pcolor() does not understand datetime.


Simply convert to datenum in the pcolor command like:

t = datetime(...);

dat = ...
y = ...

pcolor(datenum(t), y, dat)
datetick('x', 'HH:MM:ss',  'keepticks')


Python matplotlib has supported datetime.datetime and numpy.datetime64 in most plot functions for a long time already.