MATLAB: How to remove period stamp in datetime plot

datetimelabel;layoutMATLABplotundocumented

How do I remove the period stamp when a datetime vector is plotted ?
Example code:
close all
t=datetime('now'):hours(1):(datetime('now')+days(7));
P=1:(size(t,2));
plot(t,P)
xtickformat('eee HH:mm' )
ax = gca;
ax.XTick = t(1):days(1):t(end);
Plot with period shown in lower right corner, indicated by the red arrow.

Best Answer

You can manually replace the strings used on the ticks after setting the XTick property:
close all
t=datetime('now'):hours(1):(datetime('now')+days(7));
P=1:(size(t,2));
plot(t,P)
% xtickformat('eee HH:mm' )
ax = gca;
ax.XTick = t(1):days(1):t(end);
ax.XTickLabelMode = 'manual';
ax.XTickLabel = datestr(ax.XTick,'ddd HH:mm'); % see datestr formatOut
Related Question