eelbrain.plot.GlassBrain

class eelbrain.plot.GlassBrain(ndvar, cmap=None, vmin=None, vmax=None, dest='mri', mri_resolution=False, mni305=None, black_bg=False, display_mode=None, threshold=None, colorbar=False, draw_cross=True, annotate=True, alpha=0.7, plot_abs=False, draw_arrows=True, symmetric_cbar='auto', interpolation='nearest', show_time=False, **kwargs)

Plot 2d projections of a brain volume

Based on nilearn.plotting.plot_glass_brain().

Parameters
  • ndvar (NDVar ([case,] time, source[, space])) – Data to plot; if ndvar has a case dimension, the mean is plotted. if ndvar has a space dimension, the norm is plotted.

  • cmap (str) – Colormap (name of a matplotlib colormap).

  • vmin (scalar) – Plot data range minimum.

  • vmax (scalar) – Plot data range maximum.

  • dest ('mri' | 'surf') – If ‘mri’ the volume is defined in the coordinate system of the original T1 image. If ‘surf’ the coordinate system of the FreeSurfer surface is used (Surface RAS).

  • mri_resolution (bool) – If True the image is created in MRI resolution through upsampling. WARNING: it can result in significantly high memory usage.

  • mni305 (bool) – Project data from MNI-305 space to MNI-152 space (by default this is enabled iff the source space subject is fsaverage).

  • black_bg (boolean. Default is 'False') – If True, the background of the image is set to be black.

  • display_mode (str) –

    Direction of the cuts:

    • 'x': sagittal

    • 'y': coronal

    • 'z': axial

    • 'l': sagittal, left hemisphere only

    • 'r': sagittal, right hemisphere only

    • 'ortho': three cuts in orthogonal directions, equivalent to 'yxz'

    Possible values are: ‘ortho’, ‘x’, ‘y’, ‘z’, ‘xz’, ‘yx’, ‘yz’, ‘l’, ‘r’, ‘lr’, ‘lzr’, ‘lyr’, ‘lzry’, ‘lyrz’. The default depends on the data: ‘lyr’ if both hemispheres are present, ‘xz’ if only one is.

  • threshold (scalar | 'auto') – If a number is given, values below the threshold (in absolute value) are plotted as transparent. If 'auto' is given, the threshold is determined magically by analysis of the image.

  • colorbar (boolean) – If True, display a colorbar on the right of the plots.

  • draw_cross (boolean) – If draw_cross is True, a cross is drawn on the plot to indicate the cut plosition.

  • annotate (boolean) – If annotate is True, positions and left/right annotation are added to the plot.

  • alpha (float between 0 and 1) – Alpha transparency for the brain schematics

  • plot_abs (bool) – Plot the maximum intensity projection of the absolute value (rendering positive and negative values in the same manner). By default, (False), the sign of the maximum intensity will be represented with different colors. See examples.

  • draw_arrows (boolean) – Draw arrows in the direction of activation over the glassbrain plots. Naturally, for this to work ndvar needs to contain space dimension (i.e 3D vectors). By default it is set to True.

  • symmetric_cbar (boolean | 'auto') – Specifies whether the colorbar should range from -vmax to vmax or from vmin to vmax. Setting to ‘auto’ will select the latter if the range of the whole image is either positive or negative. Note: The colormap will always be set to range from -vmax to vmax.

  • interpolation (str) – Interpolation to use when resampling the image to the destination space. Can be “continuous” to use 3rd-order spline interpolation, or “nearest” to use nearest-neighbor mapping. “nearest” (default) is faster but can be noisier in some cases.

  • title (str | bool) – Figure title. Set to True to display current time point as figure title.

  • ... – Also accepts General layout parameters.

Notes

The brain overlay assumes coordinates in MNI152 space (see The MNI brain and the Talairach atlas). For data with different coordinates, the brain shape overlay will not be accurate.

Methods

add_hline(y[, axes])

Draw a horizontal line on one or more axes

add_hspan(bottom, top[, axes])

Draw a horizontal bar on one or more axes

add_vline(x[, axes])

Draw a vertical line on one or more axes

add_vspan(xmin, xmax[, axes])

Draw a vertical bar on one or more axes

butterfly(y[, cmap, vmin, vmax, dest, ...])

Shortcut for a butterfly-plot with a time-linked glassbrain plot

close()

Close the figure.

draw()

(Re-)draw the figure (after making manual changes).

draw_crosshairs([enable])

Draw crosshairs under the cursor

draw_outline([color])

Draw the outline of the figure

get_time()

Retrieve the current time

image([name, format, close])

Create FMTXT Image from the figure

link_time_axis(other)

Link the time axis of this figure with another figure

play_movie([time_dilation])

Cycle through the time axis

plot_colorbar([label, label_position, ...])

Plot a colorbar corresponding to the displayed data

save(*args, **kwargs)

Short-cut for Matplotlib's savefig()

save_movie([filename, time_dilation])

Save the figure with moving time axis as movie

set_name(name)

Set the figure window title

set_time(time)

Set the time point to display

set_xlabel(label[, ax])

Set the label for the x-axis

set_xtick_rotation(rotation)

Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)

set_ylabel(label[, ax])

Set the label for the y-axis