hypnoplot¶
- hypnoplot(stage_times, stage_vals, varargin)
HYPNOPLOT Plot a shaded hypnogram (sleep staging over time) with optional artifact bar
- Usage:
hyp_handle = hypnoplot(stage_times, stage_vals, ‘Name’, Value, …)
- Inputs:
stage_times : 1xN double - stage onset times; each stage spans stage_times(t) to stage_times(t+1) – required stage_vals : 1xN double - stage codes (6=Art, 5=Wake, 4=REM, 3=N1, 2=N2, 1=N3, 0=Undef) – required
- Name-Value Pairs:
‘Artifacts’ : 1xT logical - artifact mask (requires either Fs or ArtifactTimes) (default: []) ‘Fs’ : double - artifact sampling frequency, Hz (default: []) ‘ArtifactTimes’ : 1xT double - artifact time values in seconds (default: []) ‘HypnogramLabels’ : 1x7 cell - stage name labels (default: {‘Undef’,’N3’,’N2’,’N1’,’REM’,’Wake’,’Art’}) ‘LabelPos’ : char - ‘top’ or ‘left’ (default: ‘left’) ‘StageColors’ : 7x3 double - color for each stage row ‘GroupNREMColors’ : logical - one color for NREM (N1-N3) instead of three (default: true) ‘PlotBuffer’ : double - vertical padding on top/bottom (default: 0.3)
- Outputs:
hyp_handle : handle - stairs object for the hypnogram trace
Example
stage_vals = [0 0 0 5 5 5 4 3 2 2 2 1 2 1 2 3 5 5 5 1 5 1 2 5 3 2 1 4 4 4 5 4 0 3 2 1 1 5 5 5 0 0 0]; stage_times = (0:length(stage_vals)-1)*30; hypnoplot(stage_times, stage_vals);
See also: stairs, interp1
∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿