eelbrain.plot.brain.SequencePlotter

class eelbrain.plot.brain.SequencePlotter(subject=None, subjects_dir=None)

Grid of anatomical images in one figure

Notes

For plots with multiple layers, layers are added to the brain in the order they were added to the SequencePlotter.

Examples

Plot an evoked response or TRF (i.e., a time by source NDVar) in 50 ms bins between 0 and 300 ms. Use the extrema() method to plot peak activity in each time bin:

ndvar_binned = ndvar.bin(step=0.050, start=0, stop=0.3, func='extrema')
sp = plot.brain.SequencePlotter()
sp.set_brain_args(surf='smoothwm')
sp.add_ndvar(ndvar_binned)
p = sp.plot_table(view='lateral')
p.save('Figure.pdf')

Plot specific time points in an evoked response or TRF (ndvar):

cmap = plot.soft_threshold_colormap('xpolar-a', 0.0001, 0.010)
sp = plot.brain.SequencePlotter()
sp.set_brain_args(surf='smoothwm')
for t in [0.050, 0.100, 0.200]:
    sp.add_ndvar(ndvar.sub(time=t), cmap=cmap, label=f'{int(t*1000)} ms')
p = sp.plot_table(view='lateral', orientation='vertical')

Plot a test result:

res = testnd.TTestRelated('srcm', 'condition')
vmax = 3  # explicitly set vmax to make sure that the color-maps agree
sp = plot.brain.SequencePlotter()
sp.set_brain_args(surf='inflated')
sp.add_ndvar(res.c1_mean, vmax=vmax, label='a')
sp.add_ndvar(res.c0_mean, vmax=vmax, label = 'b')
sp.add_ndvar(res.masked_difference(), vmax=vmax, label='a - b')
p = sp.plot_table(view='lateral', orientation='vertical')

Methods

add_function(func[, label, overlay])

Custom modification of the brain object (calls func(brain))

add_label(mne_label, *[, overlay, index, label])

add_ndvar(ndvar, *args[, static, index, label])

Add a data layer to the brain plot

add_ndvar_label(ndvar[, color, borders, ...])

Add a boolean label to the brain plot

add_pmap(res[, label])

See add_ndvar_p_map()

plot_table([hemi, view, orientation, ...])

Create a figure with the images

set_brain([source, subject, subjects_dir])

Set the brain model on which to plot

set_brain_args([surf, foreground, ...])

Set parameters for anatomical plot (see brain())

set_frame_order(order)

Set the order in which frames are plotted

set_parallel_view([forward, up, scale])

Set view for all plots (see set_parallel_view()