A start...basically, you just generate datenums that match the locations you want.
dt=datenum(2014,5,[10:12]);
xt=repmat(dt,3,1); xt=xt(:);
xt(3:3:end)=nan;
yt=repmat([-0.95 -1.1 nan]',3,1);
hl=line(xt,yt,'color','r','clipping','off');
ht=text(dt+0.5,-1.2*ones(size(dt)),datestr(dt,'mm.dd.yyyy'),'horizontal','center','fontsize',8);
(*) The "trick" in generating the arrays is that of inserting the NaN between the line segments to avoid drawing from the end point of the first the diagonal to the first point of the second, etc., ...
On the location for the datestr, I didn't create the other vector of locations; just used the midnight location plus 0.5 day to get noon next day for demo purposes of the idea. That works correctly for the full days in the middle, otherwise you take the average of the two datenums for the beginning and end of the partial days at the two ends.
Also, in my playing here I used a ylim(-1 1)] and the y locations for the line and the text are based on that value--you'll want to retrieve the lower y limit and adjust based on it for your case. Alternatively, you can switch to normalized coordinates relative to the whole figure and retrieve the position of the axes and work out locations therefrom. annotation works on those coordinates so if choose to go that route instead you'll have to use those. I tend to just use the axes and smudge a little. Note to get the line to show outside the axes, must set its 'clipping' property to 'off'
Best Answer