stacked_plot¶
- stacked_plot(ax, data, x, varargin)¶
STACKED_PLOT Plot multi-channel data as vertically stacked subplots with scale bars and optional row merging
- Usage:
new_axes = stacked_plot(ax, data) new_axes = stacked_plot(ax, data, x) new_axes = stacked_plot(ax, data, x, ‘Name’, Value, …)
- Inputs:
ax : axes handle (default: gca) data : RxC double - R channels, C samples – required x : 1xC numeric or datetime - sample positions (default: 1:C)
- Name-Value Pairs:
‘ylabels’ : cell or string array - subplot labels (default: auto from merge) ‘skip’ : integer - plot every nth sample (default: 1) ‘colors’ : Rx3 double - per-channel RGB (default: lines(R)) ‘xscale’ : numeric scalar or datetime - x-axis scale bar length (default: []) ‘xlabel’ : char - x scale bar label (default: ‘’) ‘yscale’ : numeric vector - per-subplot y scale bar length (default: []) ‘ylabel’ : cell or string array - y scale bar labels (default: {}) ‘merge’ : cell array - rows to merge per subplot (default: each row its own subplot)
- Outputs:
new_axes : array of axes handles
Example
data = randn(7, 100); x = datetime(2025,12,22,0,0,0) + minutes(1)*(0:99); merge = {[1 5], 2, 3, [4 7], 6}; new_axes = stacked_plot(gca, data, x, ‘merge’, merge, ‘skip’, 2);
See also: split_axis, scaleline
∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿