Skip to content

2.5.5 plotEvent()

Shun Li edited this page Dec 6, 2023 · 3 revisions

Overview

Inputs and options

Required inputs

  • label: string, the name of the event that is aligned to. If you don't wish to add any text next to the vertical line, input '' instead.
  • duration double, the duration of the event in seconds. It will display as shaded areas with lighter color (determined by FaceAlpha described below) comparing to the color defined below. If the event is short and meaningless to plot the shaded areas, input 0 instead.

Options

  • color: default is 'r'; can input any format of color that Matlab accepts.
  • x: double, default is 0; determines where on the x axis the vertical line is plotted at. Since by default traces are aligned at 0, the default is also 0
  • unit: string, default is 's'; determines the unit of duration. Can also be ms.
  • FaceAlpha: double, default is 0.1; determines the color difference between the vertical line and following shaded areas.
  • LineWidth: double, default is 1.5; determines the width of the vertical line. See Matlab documentation for more information.
  • LineStyle: string, default is '-'; determines the style of the vertical line. See Matlab documentation for more information.

Outputs

  • There is not explicit outputs of this function, it will plot a vertical line in the existing figure instance (ie gcf)

Examples

  1. If the event have no duration
initializeFig(0.5,0.3);
[traces,t] = plotTraces(waterIdx,timeRange,signal,bluePurpleRed(1,:),params,...
                        signalFs=50,signalSystem='LJ');
plotEvent(Water,0,color=bluePurpleRed(1,:));
xlabel('Time (s)'); ylabel('z-score');

image

  1. If the event have some certain duration
initializeFig(0.5,0.3);
combined = combineTraces(animals,timeRange=[-0.5,3],...
                            eventRange='Stim',...
                            animalRange=["SL133","SL135"],...
                            taskRange='Random',...
                            totalTrialRange=totalTrialRange,...
                            trialRange=trialRange,...
                            signalRange='NAc');
plotSEM(combined.timestamp,combined.data{1},bluePurpleRed(end,:));
plotEvent('Stim',500,color=bluePurpleRed(end,:),unit='ms')
xlabel('Time (s)'); ylabel('z-score');

image

Clone this wiki locally