DateTimeLine¶
- DateTimeLine()¶
DATETIMELINE Interactive draggable line segment supporting datetime axes
- Usage:
ln = DateTimeLine(ax, pos, callback) ln = DateTimeLine(ax, pos, callback, ‘Name’, Value, …)
- Inputs:
ax : axes handle - target axes – required pos : struct with fields x1, y1, x2, y2 (datetime or double) – required callback : function handle - called after every position change – required
- Outputs:
ln : DateTimeLine handle object
Notes
Supports numeric and datetime x-axes. Two endpoint handles allow precise positioning; dragging the line body moves both together. Observable appearance properties (LineColor, LineWidth, HandleSize) update the graphics automatically when modified.
Example
ax = axes; plot(ax, datetime(2023,1,1)+days(0:100), rand(1,101)); pos.x1 = datetime(2023,1,10); pos.y1 = 0.2; pos.x2 = datetime(2023,1,30); pos.y2 = 0.8; ln = DateTimeLine(ax, pos, @(p)disp(p));
See also: DateTimeRectangle, EventMarker
∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿