eelbrain.plot.TopoButterfly

class eelbrain.plot.TopoButterfly(y, xax=None, ds=None, sub=None, vmax=None, vmin=None, cmap=None, contours=None, color=None, linewidth=None, proj='default', res=None, interpolation=None, clip='even', clip_distance=0.05, head_radius=None, head_pos=0, im_interpolation=None, sensorlabels=None, mark=None, mcolor=None, xlabel=True, ylabel=True, xticklabels=-1, axtitle=True, frame=True, xlim=None, *args, **kwargs)

Butterfly plot with corresponding topomaps

Parameters:
y : (list of) NDVar

Data to plot.

xax : None | categorial

Create a separate plot for each cell in this model.

ds : None | Dataset

If a Dataset is provided, data can be specified as strings.

sub : str | array

Specify a subset of the data.

vmax : scalar

Upper limits for the colormap (default is determined from data).

vmin : scalar

Lower limit for the colormap (default -vmax).

cmap : str

Colormap (default depends on the data).

contours : int | sequence | dict

Contours to draw on topomaps. Can be an int (number of contours, including vmin/vmax), a sequence (values at which to draw contours), or a **kwargs dict (must contain at least the “levels” key). Default is no contours.

color : matplotlib color

Color of the butterfly plots.

linewidth : scalar

Linewidth for plots (defult is to use matplotlib.rcParams).

proj : str

The sensor projection to use for topomaps.

res : int

Resolution of the topomaps (width = height = res).

interpolation : ‘nearest’ | ‘linear’ | ‘spline’

Method for interpolating topo-map between sensors (default is based on mne-python).

clip : bool | ‘even’ | ‘circle’

Outline for clipping topomaps: ‘even’ to clip at a constant distance (default), ‘circle’ to clip using a circle.

clip_distance : scalar

How far from sensor locations to clip (1 is the axes height/width).

head_radius : scalar | tuple

Radius of the head outline drawn over sensors (on sensor plots with normalized positions, 0.45 is the outline of the topomap); 0 to plot no outline; tuple for separate (right, anterior) radius. The default is determined automatically.

head_pos : scalar

Head outline position along the anterior axis (0 is the center, 0.5 is the top end of the plot).

im_interpolation : str

Topomap image interpolation (see Matplotlib’s imshow()). Matplotlib 1.5.3’s SVG output can’t handle uneven aspect with interpolation='none', use interpolation='nearest' instead.

sensorlabels : ‘none’ | ‘index’ | ‘name’ | ‘fullname’

Show sensor labels. For ‘name’, any prefix common to all names is removed; with ‘fullname’, the full name is shown.

mark : Sensor index

Sensors which to mark.

mcolor : matplotlib color

Color for marked sensors.

xlabel, ylabel : bool | string

Labels for x and y axes. If True, labels are automatically chosen.

xticklabels : bool | int | list of int

Specify which axes should be annotated with x-axis tick labels. Use int for a single axis (default -1), a sequence of int for multiple specific axes, or bool for all/none.

axtitle : bool | sequence of str

Title for the individual axes. The default is to show the names of the epochs, but only if multiple axes are plotted.

xlim : scalar | (scalar, scalar)

Initial x-axis view limits as (left, right) tuple or as length scalar (default is the full x-axis in the data).

Also accepts General layout parameters.

Notes

Topomap control:
  • LMB click in a butterfly plot fixates the topomap time
  • RMB click in a butterfly plot removes the time point, the topomaps follow the mouse pointer
  • .: Increment the current topomap time (got right)
  • ,: Decrement the current topomap time (go left)
  • t: open a Topomap plot for the time point under the mouse pointer
  • T: open a larger Topomap plot with visible sensor names for the time point under the mouse pointer
Navigation:
  • : scroll up
  • : scroll down
  • : scroll left
  • : scroll right
  • home: scroll to beginning
  • end: scroll to end
  • f: x-axis zoom in (reduce x axis range)
  • d: x-axis zoom out (increase x axis range)
  • r: y-axis zoom in (reduce y-axis range)
  • c: y-axis zoom out (increase y-axis range)

Methods

add_contour(self, level[, color, meas]) Add a contour line
add_hline(self, y[, axes]) Draw a horizontal line on one or more axes
add_hspan(self, bottom, top[, axes]) Draw a horizontal bar on one or more axes
add_vline(self, x[, axes]) Draw a vertical line on one or more axes
add_vspan(self, xmin, xmax[, axes]) Draw a vertical bar on one or more axes
add_vspans(self, intervals[, axes]) Draw vertical bars over axes
close(self) Close the figure.
draw(self) (Re-)draw the figure (after making manual changes).
draw_crosshairs(self[, enable]) Draw crosshairs under the cursor
get_time(self) Retrieve the current time
get_vlim(self[, meas]) Retrieve colormap value limits as (vmin, vmax) tuple
get_xlim(self)
get_ylim(self)
image(self[, name, format]) Create FMTXT Image from the figure
link_time_axis(self, other) Link the time axis of this figure with another figure
play_movie(self[, time_dilation]) Cycle through the time axis
plot_colorbar(self[, label, label_position, …]) Plot a colorbar corresponding to the displayed data
save(self, *args, **kwargs) Short-cut for Matplotlib’s savefig()
save_movie(self[, filename, time_dilation]) Save the figure with moving time axis as movie
set_cmap(self, cmap[, meas]) Change the colormap in the array plots
set_name(self, name) Set the figure window title
set_time(self, time) Set the time point to display
set_vlim(self[, v, vmax, meas]) Change the colormap limits
set_xlabel(self, label[, ax]) Set the label for the x-axis
set_xlim(self[, left, right]) Set the x-axis limits for all axes
set_xtick_rotation(self, rotation) Rotate every x-axis tick-label by an angle (counterclockwise, in degrees)
set_ylabel(self, label[, ax]) Set the label for the y-axis
set_ylim(self[, bottom, top]) Set the y-axis limits