mne.viz.plot_raw(raw, events=None, duration=10.0, start=0.0, n_channels=20, bgcolor='w', color=None, bad_color=(0.8, 0.8, 0.8), event_color='cyan', scalings=None, remove_dc=True, order=None, show_options=False, title=None, show=True, block=False, highpass=None, lowpass=None, filtorder=4, clipping=None, show_first_samp=False, proj=True, group_by='type', butterfly=False, decim='auto', noise_cov=None, event_id=None)[source]

Plot raw data.

raw : instance of Raw

The raw data to plot.

events : array | None

Events to show with vertical bars.

duration : float

Time window (s) to plot. The lesser of this value and the duration of the raw file will be used.

start : float

Initial time to show (can be changed dynamically once plotted). If show_first_samp is True, then it is taken relative to raw.first_samp.

n_channels : int

Number of channels to plot at once. Defaults to 20. Has no effect if order is ‘position’, ‘selection’ or ‘butterfly’.

bgcolor : color object

Color of the background.

color : dict | color object | None

Color for the data traces. If None, defaults to:

dict(mag='darkblue', grad='b', eeg='k', eog='k', ecg='m',
     emg='k', ref_meg='steelblue', misc='k', stim='k',
     resp='k', chpi='k')
bad_color : color object

Color to make bad channels.

event_color : color object | dict

Color to use for events. Can also be a dict with {event_number: color} pairings. Use event_number==-1 for any event numbers in the events list that are not in the dictionary.

scalings : dict | None

Scaling factors for the traces. If any fields in scalings are ‘auto’, the scaling factor is set to match the 99.5th percentile of a subset of the corresponding data. If scalings == ‘auto’, all scalings fields are set to ‘auto’. If any fields are ‘auto’ and data is not preloaded, a subset of times up to 100mb will be loaded. If None, defaults to:

dict(mag=1e-12, grad=4e-11, eeg=20e-6, eog=150e-6, ecg=5e-4,
     emg=1e-3, ref_meg=1e-12, misc=1e-3, stim=1,
     resp=1, chpi=1e-4, whitened=1e2)
remove_dc : bool

If True remove DC component when plotting data.

order : array of int | None

Order in which to plot data. If the array is shorter than the number of channels, only the given channels are plotted. If None (default), all channels are plotted. If group_by is 'position' or 'selection', the order parameter is used only for selecting the channels to be plotted.

show_options : bool

If True, a dialog for options related to projection is shown.

title : str | None

The title of the window. If None, and either the filename of the raw object or ‘<unknown>’ will be displayed as title.

show : bool

Show figure if True.

block : bool

Whether to halt program execution until the figure is closed. Useful for setting bad channels on the fly by clicking on a line. May not work on all systems / platforms.

highpass : float | None

Highpass to apply when displaying data.

lowpass : float | None

Lowpass to apply when displaying data.

filtorder : int

Filtering order. Note that for efficiency and simplicity, filtering during plotting uses forward-backward IIR filtering, so the effective filter order will be twice filtorder. Filtering the lines for display may also produce some edge artifacts (at the left and right edges) of the signals during display. Filtering requires scipy >= 0.10.

clipping : str | None

If None, channels are allowed to exceed their designated bounds in the plot. If “clamp”, then values are clamped to the appropriate range for display, creating step-like artifacts. If “transparent”, then excessive values are not shown, creating gaps in the traces.

show_first_samp : bool

If True, show time axis relative to the raw.first_samp.

proj : bool

Whether to apply projectors prior to plotting (default is True). Individual projectors can be enabled/disabled interactively (see Notes). This argument only affects the plot; use raw.apply_proj() to modify the data stored in the Raw object.

group_by : str

How to group channels. 'type' groups by channel type, 'original' plots in the order of ch_names, 'selection' uses Elekta’s channel groupings (only works for Neuromag data), 'position' groups the channels by the positions of the sensors. 'selection' and 'position' modes allow custom selections by using lasso selector on the topomap. Pressing ctrl key while selecting allows appending to the current selection. Channels marked as bad appear with red edges on the topomap. 'type' and 'original' groups the channels by type in butterfly mode whereas 'selection' and 'position' use regional grouping. 'type' and 'original' modes are overrided with order keyword.

butterfly : bool

Whether to start in butterfly mode. Defaults to False.

decim : int | ‘auto’

Amount to decimate the data during display for speed purposes. You should only decimate if the data are sufficiently low-passed, otherwise aliasing can occur. The ‘auto’ mode (default) uses the decimation that results in a sampling rate least three times larger than min(info['lowpass'], lowpass) (e.g., a 40 Hz lowpass will result in at least a 120 Hz displayed sample rate).

noise_cov : instance of Covariance | str | None

Noise covariance used to whiten the data while plotting. Whitened data channels are scaled by scalings['whitened'], and their channel names are shown in italic. Can be a string to load a covariance from disk. See also mne.Evoked.plot_white() for additional inspection of noise covariance properties when whitening evoked data. For data processed with SSS, the effective dependence between magnetometers and gradiometers may introduce differences in scaling, consider using mne.Evoked.plot_white().

New in version 0.16.0.

event_id : dict | None

Event IDs used to show at event markers (default None shows theh event numbers).

New in version 0.16.0.

fig : Instance of matplotlib.figure.Figure

Raw traces.


The arrow keys (up/down/left/right) can typically be used to navigate between channels and time ranges, but this depends on the backend matplotlib is configured to use (e.g., mpl.use(‘TkAgg’) should work). The left/right arrows will scroll by 25% of duration, whereas shift+left/shift+right will scroll by 100% of duration. The scaling can be adjusted with - and + (or =) keys. The viewport dimensions can be adjusted with page up/page down and home/end keys. Full screen mode can be toggled with the F11 key. To mark or un-mark a channel as bad, click on a channel label or a channel trace. The changes will be reflected immediately in the raw object’s['bads'] entry.

If projectors are present, a button labelled “Proj” in the lower right corner of the plot window opens a secondary control window, which allows enabling/disabling specific projectors individually. This provides a means of interactively observing how each projector would affect the raw data if it were applied.

Annotation mode is toggled by pressing ‘a’, butterfly mode by pressing ‘b’, and whitening mode (when noise_cov is not None) by pressing ‘w’.