mne.viz.plot_ica_components#
- mne.viz.plot_ica_components(ica, picks=None, ch_type=None, res=64, vmin=None, vmax=None, cmap='RdBu_r', sensors=True, colorbar=False, title=None, show=True, outlines='head', contours=6, image_interp='cubic', inst=None, plot_std=True, topomap_args=None, image_args=None, psd_args=None, reject='auto', sphere=None, *, verbose=None)[source]#
Project mixing matrix on interpolated sensor topography.
- Parameters:
- icainstance of
mne.preprocessing.ICA
The ICA solution.
- picks
int
|list
ofint
|slice
|None
Indices of the independent components (ICs) to visualize. If an integer, represents the index of the IC to pick. Multiple ICs can be selected using a list of int or a slice. The indices are 0-indexed, so
picks=1
will pick the second IC:ICA001
.None
will pick all independent components in the order fitted.- ch_type‘mag’ | ‘grad’ | ‘planar1’ | ‘planar2’ | ‘eeg’ |
None
The channel type to plot. For
'grad'
, the gradiometers are collected in pairs and the RMS for each pair is plotted. IfNone
the first available channel type from order shown above is used. Defaults toNone
.- res
int
The resolution of the topomap image (number of pixels along each side).
- vmin, vmax
float
|callable()
|None
Lower and upper bounds of the colormap, in the same units as the data. If
vmin
andvmax
are bothNone
, they are set at ± the maximum absolute value of the data (yielding a colormap with midpoint at 0). If only one ofvmin
,vmax
isNone
, will usemin(data)
ormax(data)
, respectively. If callable, should accept aNumPy array
of data and return a float.- cmapmatplotlib colormap | (colormap,
bool
) | ‘interactive’ |None
Colormap to use. If
tuple
, the first value indicates the colormap to use and the second value is a boolean defining interactivity. In interactive mode the colors are adjustable by clicking and dragging the colorbar with left and right mouse button. Left mouse button moves the scale up and down and right mouse button adjusts the range. Hitting space bar resets the range. Up and down arrows can be used to change the colormap. IfNone
,'Reds'
is used for data that is either all-positive or all-negative, and'RdBu_r'
is used otherwise.'interactive'
is equivalent to(None, True)
. Defaults toNone
.Warning
Interactive mode works smoothly only for a small amount of topomaps. Interactive mode is disabled by default for more than 2 topomaps.
- sensors
bool
|str
Whether to add markers for sensor locations. If
str
, should be a valid matplotlib format string (e.g.,'r+'
for red plusses, see the Notes section ofplot()
). IfTrue
(the default), black circles will be used.- colorbar
bool
Plot a colorbar in the rightmost column of the figure.
- title
str
|None
Title to use.
- show
bool
Show the figure if
True
.- outlines‘head’ | ‘skirt’ |
dict
|None
The outlines to be drawn. If ‘head’, the default head scheme will be drawn. If ‘skirt’ the head scheme will be drawn, but sensors are allowed to be plotted outside of the head circle. If dict, each key refers to a tuple of x and y positions, the values in ‘mask_pos’ will serve as image mask. Alternatively, a matplotlib patch object can be passed for advanced masking options, either directly or as a function that returns patches (required for multi-axis plots). If None, nothing will be drawn. Defaults to ‘head’.
Deprecated since version v1.2: The
outlines='skirt'
option is no longer supported and will raise an error starting in version 1.3. Passoutlines='head', sphere='eeglab'
for similar behavior.- contours
int
| array_like The number of contour lines to draw. If
0
, no contours will be drawn. If a positive integer, that number of contour levels are chosen using the matplotlib tick locator (may sometimes be inaccurate, use array for accuracy). If array-like, the array values are used as the contour levels. The values should be in µV for EEG, fT for magnetometers and fT/m for gradiometers. Ifcolorbar=True
, the colorbar will have ticks corresponding to the contour levels. Default is6
.- image_interp
str
The image interpolation to be used. Options are
'cubic'
(default) to usescipy.interpolate.CloughTocher2DInterpolator
,'nearest'
to usescipy.spatial.Voronoi
or'linear'
to usescipy.interpolate.LinearNDInterpolator
.- inst
Raw
|Epochs
|None
To be able to see component properties after clicking on component topomap you need to pass relevant data - instances of Raw or Epochs (for example the data that ICA was trained on). This takes effect only when running matplotlib in interactive mode.
- plot_std
bool
|float
Whether to plot standard deviation in ERP/ERF and spectrum plots. Defaults to True, which plots one standard deviation above/below. If set to float allows to control how many standard deviations are plotted. For example 2.5 will plot 2.5 standard deviation above/below.
- topomap_args
dict
|None
Dictionary of arguments to
plot_topomap
. If None, doesn’t pass any additional arguments. Defaults to None.- image_args
dict
|None
Dictionary of arguments to
plot_epochs_image
. If None, doesn’t pass any additional arguments. Defaults to None.- psd_args
dict
|None
Dictionary of arguments to
psd_multitaper
. If None, doesn’t pass any additional arguments. Defaults to None.- reject‘auto’ |
dict
|None
Allows to specify rejection parameters used to drop epochs (or segments if continuous signal is passed as inst). If None, no rejection is applied. The default is ‘auto’, which applies the rejection parameters used when fitting the ICA object.
- sphere
float
| array_like | instance ofConductorModel
|None
| ‘auto’ | ‘eeglab’ The sphere parameters to use for the head outline. Can be array-like of shape (4,) to give the X/Y/Z origin and radius in meters, or a single float to give just the radius (origin assumed 0, 0, 0). Can also be an instance of a spherical
ConductorModel
to use the origin and radius from that object. If'auto'
the sphere is fit to digitization points. If'eeglab'
the head circle is defined by EEG electrodes'Fpz'
,'Oz'
,'T7'
, and'T8'
(if'Fpz'
is not present, it will be approximated from the coordinates of'Oz'
).None
(the default) is equivalent to'auto'
when enough extra digitization points are available, and (0, 0, 0, 0.095) otherwise.New in version 0.20.
Changed in version 1.1: Added
'eeglab'
option.- verbose
bool
|str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- icainstance of
- Returns:
- figinstance of
matplotlib.figure.Figure
|list
ofmatplotlib.figure.Figure
The figure object(s). Components are plotted on a grid with maximum dimensions of 5⨉4. If more than 20 components are plotted, a new figure will be created for each batch of 20, and a list of those figures will be returned.
- figinstance of
Notes
When run in interactive mode,
plot_ica_components
allows to reject components by clicking on their title label. The state of each component is indicated by its label color (gray: rejected; black: retained). It is also possible to open component properties by clicking on the component topomap (this option is only available when theinst
argument is supplied).