eelbrain.plot.TopoButterfly
- class eelbrain.plot.TopoButterfly(y, xax=None, data=None, sub=None, vmax=None, vmin=None, cmap=None, contours=None, color=None, linewidth=None, t=None, proj='default', res=None, interpolation=None, clip='even', clip_distance=0.05, head_radius=None, head_pos=0, im_interpolation=None, sensors='.', sensorlabels=None, mark=None, mcolor=None, xlabel=True, ylabel=True, xticklabels='bottom', yticklabels='left', axtitle=True, frame=True, xlim=None, **kwargs)
Butterfly plot with corresponding topomaps
- Parameters:
y (NDVarArg | Sequence[NDVarArg] | Sequence[Sequence[NDVarArg]]) – Data to plot. A plain
NDVaror list ofNDVarproduces the standard single-topomap layout. A list of lists enables a multi-modality layout: each inner list represents one plot row and contains oneNDVarper sensor modality (e.g.[[mag_original, eeg_original], [mag_cleaned, eeg_cleaned]]). In this case the butterfly traces for each row are formed by concatenating all modalities after normalizing each one to its data range (determined viavmax/vminor derived automatically from the data), so that channels with very different physical units are visible on a common axis. One topomap column is added to the right for each modality, each with its own color scale. Scaling is shared per modality column across rows, so relative amplitudes between rows are preserved.xax (CategorialArg) – Create a separate plot for each cell in this model.
data (Dataset) – If a Dataset is provided, data can be specified as strings.
sub (IndexArg) – Specify a subset of the data.
vmax (float) – Upper limits for the colormap (default is determined from data).
vmin (float) – Lower limit for the colormap (default
-vmax).cmap (CMapArg) – Colormap (default depends on the data).
contours (int | Sequence | dict) – Draw contours. Can be an int (number of contours, including
vminandvmax), a sequence (values at which to draw contours), or a dictionary with**kwargsforcontour()(must include a"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).t (float) – Time to display in the topomap.
proj (str) – The sensor projection to use for topomaps.
res (int) – Resolution of the topomaps (width = height =
res).interpolation (InterpolationArg) – 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 withinterpolation='none', useinterpolation='nearest'instead.sensors (str | matplotlib.markers.MarkerStyle) – How to mark sensor locations in the topomap (empty string
''to omit marks).sensorlabels (SensorLabelsArg) – Show sensor labels. For ‘name’, any prefix common to all names is removed; with ‘fullname’, the full name is shown.
mark (Sensor index) – Sensors to mark in the topo-map. To highlight sensors in the butterfly plot, consider using
NDVar.mask()ony.mcolor (matplotlib color) – Color for marked sensors.
xlabel (bool | str) – X-axis label. By default the label is inferred from the data.
ylabel (bool | str) – Y-axis label. By default the label is inferred from the data.
xticklabels (str | int | Sequence[int]) – Specify which axes should be annotated with x-axis tick labels. Use
intfor a single axis, a sequence ofintfor multiple specific axes, or one of'left' | 'bottom' | 'all' | 'none'.yticklabels (str | int | Sequence[int]) – Specify which axes should be annotated with y-axis tick labels. Use
intfor a single axis, a sequence ofintfor multiple specific axes, or one of'left' | 'bottom' | '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 aslengthscalar (default is the full x-axis in the data).... – Also accepts General layout parameters.
frame (bool)
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 aTopomapplot for the time point under the mouse pointerT: open a largerTopomapplot with visible sensor names for the time point under the mouse pointer
- Navigation:
↑: scroll up↓: scroll down←: scroll left→: scroll righthome: scroll to beginningend: scroll to endf: 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 a contour line |
|
Draw a horizontal line on one or more axes |
|
Draw a horizontal bar on one or more axes |
|
Draw a vertical line on one or more axes |
|
Draw a vertical bar on one or more axes |
|
Draw vertical bars over axes |
|
Close the figure. |
|
(Re-)draw the figure (after making manual changes). |
|
Draw crosshairs under the cursor |
|
Draw the outline of the figure |
|
Retrieve the current time |
|
Retrieve colormap value limits as |
|
|
|
|
|
Create FMTXT Image from the figure |
|
Link the time axis of this figure with another figure |
|
Cycle through the time axis |
|
Plot a colorbar corresponding to the displayed data |
|
Short-cut for Matplotlib's |
|
Save the figure with moving time axis as movie |
|
Change the colormap in the array plots |
|
Set the figure window title |
|
Set the time point to display |
|
Change the colormap limits |
|
Set the label for the x-axis |
|
Set the x-axis limits for all axes |
|
Rotate every x-axis tick-label by an angle (counterclockwise, in degrees) |
|
Set the label for the y-axis |
|
Set the y-axis limits |