mne.channels.generate_2d_layout

mne.channels.generate_2d_layout(xy, w=0.07, h=0.05, pad=0.02, ch_names=None, ch_indices=None, name='ecog', bg_image=None, normalize=True)[source]

Generate a custom 2D layout from xy points.

Generates a 2-D layout for plotting with plot_topo methods and functions. XY points will be normalized between 0 and 1, where normalization extremes will be either the min/max of xy, or the width/height of bg_image.

Parameters
xyndarray, shape (N, 2)

The xy coordinates of sensor locations.

wfloat

The width of each sensor’s axis (between 0 and 1).

hfloat

The height of each sensor’s axis (between 0 and 1).

padfloat

Portion of the box to reserve for padding. The value can range between 0.0 (boxes will touch, default) to 1.0 (boxes consist of only padding).

ch_nameslist

The names of each channel. Must be a list of strings, with one string per channel.

ch_indiceslist

Index of each channel - must be a collection of unique integers, one index per channel.

namestr

The name of this layout type.

bg_imagestr | ndarray

The image over which sensor axes will be plotted. Either a path to an image file, or an array that can be plotted with plt.imshow. If provided, xy points will be normalized by the width/height of this image. If not, xy points will be normalized by their own min/max.

normalizebool

Whether to normalize the coordinates to run from 0 to 1. Defaults to True.

Returns
layoutLayout

A Layout object that can be plotted with plot_topo functions and methods.

Notes

New in version 0.9.0.

Examples using mne.channels.generate_2d_layout