mvpa2.misc.plot.erp.plot_erps¶
-
mvpa2.misc.plot.erp.
plot_erps
(erps, data=None, ax=None, pre=0.2, post=None, pre_onset=None, xlabel='time (s)', ylabel='$\\mu V$', ylim=None, ymult=1.0, legend=None, xlformat='%4g', ylformat='%4g', loffset=10, alinewidth=2, **kwargs)¶ Plot multiple ERPs on a new figure.
Parameters: erps : list of tuples
List of definitions of ERPs. Each tuple should consist of (label, color, onsets) or a dictionary which defines, label, color, onsets, data. Data provided in dictionary overrides ‘common’ data provided in the next argument
data
data
Data for ERPs to be derived from 1D (samples)
ax
Where to draw (e.g. subplot instance). If None, new figure is created
pre : float, optional
Duration (seconds) to be plotted prior to onset
pre_onset : None or float
If data is already in epochs (2D) then pre_onset provides information on how many seconds pre-stimulus were used to generate them. If None, then pre_onset = pre
post : None or float
Duration (seconds) to be plotted after the onset. If any data is provided with onsets, it can’t be None. If None – plots all time points after onsets
ymult : float, optional
Multiplier for the values. E.g. if negative-up ERP plot is needed: provide ymult=-1.0
xlformat : str, optional
Format of the x ticks
ylformat : str, optional
Format of the y ticks
legend : None or string
If not None, legend will be plotted with position argument provided in this argument
loffset : int, optional
Offset in voxels for axes and tick labels. Different matplotlib frontends might have different opinions, thus offset value might need to be tuned specifically per frontend
alinewidth : int, optional
Axis and ticks line width
**kwargs
Additional arguments provided to plot_erp()
Returns: h
current fig handler
Examples
kwargs = {'SR' : eeg.SR, 'pre_mean' : 0.2} fig = plot_erps((('60db', 'b', eeg.erp_onsets['60db']), ('80db', 'r', eeg.erp_onsets['80db'])), data[:, eeg.sensor_mapping['Cz']], ax=fig.add_subplot(1,1,1,frame_on=False), pre=0.2, post=0.6, **kwargs)
or
fig = plot_erps((('60db', 'b', eeg.erp_onsets['60db']), {'color': 'r', 'onsets': eeg.erp_onsets['80db'], 'data' : data[:, eeg.sensor_mapping['Cz']]} ), data[:, eeg.sensor_mapping['Cz']], ax=fig.add_subplot(1,1,1,frame_on=False), pre=0.2, post=0.6, **kwargs)