84 lines
2.0 KiB
Matlab
84 lines
2.0 KiB
Matlab
function plot(obj, varargin)
|
|
%PLOT Plot the data of a PricklyPear object
|
|
% plot(PP)
|
|
%
|
|
% See also pricklypear/anadata
|
|
|
|
% Handle input
|
|
p = inputParser();
|
|
p.addOptional('channel', '', @(x)ischar(x)||iscell(x));
|
|
p.addOptional('metric', '', @(x)ischar(x)||iscell(x));
|
|
p.parse(varargin{:});
|
|
p = p.Results;
|
|
|
|
if ~isempty(p.channel) && ischar(p.channel)
|
|
p.channel = {p.channel};
|
|
end
|
|
if ~isempty(p.metric) && ischar(p.metric)
|
|
p.metric = {p.metric};
|
|
end
|
|
|
|
% Plot
|
|
figureFullScreen(1000, 800);
|
|
hold on;
|
|
|
|
clrs = {'green_500' 'green_700' 'green_900'...
|
|
'blue_700'...
|
|
'green_900' 'green_700' 'green_500'...
|
|
'red_700' 'red_500'};
|
|
|
|
% Select channels
|
|
channels = {'d0d' 'd0m' 'd0p' 'c' 'd1p' 'd1m' 'd1d' 'ap' 'ad'};
|
|
if ~isempty(p.channel)
|
|
[channels iChan] = intersect(channels, p.channel);
|
|
clrs = clrs(iChan);
|
|
end
|
|
|
|
% Spiketimes
|
|
spkt = spiketimes(obj);
|
|
|
|
% SubplotXY options
|
|
opts = struct();
|
|
opts.margin = [0.1 0.08 0.08 0.08];
|
|
opts.spaceBetweenPlots = 0;
|
|
opts.nX = 1;
|
|
opts.nY = numel(channels);
|
|
opts.iX = 1;
|
|
opts.iY = 1;
|
|
|
|
% Other variables
|
|
h = zeros(numel(channels), 1);
|
|
yl = [-80 60];
|
|
|
|
% For each channel
|
|
for ii = 1:numel(channels)
|
|
opts.iY = ii;
|
|
h(ii) = subplotXY(opts);
|
|
hold on;
|
|
|
|
% Plot spiketimes
|
|
if numel(spkt) > 0
|
|
plot([spkt spkt zeros(size(spkt))*nan]',...
|
|
[ones(size(spkt))*yl(1) ones(size(spkt))*yl(2) ones(size(spkt))*yl(2)]',...
|
|
'Color', [0.75 0.75 0.75]);
|
|
end
|
|
|
|
% Plot data
|
|
plot(obj.x, anadata(obj, channels{ii})+(ii-1), 'Color', mdc(clrs{ii}));
|
|
box off;
|
|
ylim(yl);
|
|
ylabel(channels{ii});
|
|
|
|
if mod(ii,2) == 0
|
|
set(gca, 'Color', [1 1 1]*0.95);
|
|
end
|
|
|
|
if ii < numel(channels)
|
|
set(gca, 'xtick', []);
|
|
end
|
|
end
|
|
|
|
linkaxes(h, 'x');
|
|
|
|
end
|