# I noticed that the electrode positions are offset when using plot\_sensors.

**URL:** <https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730>\
**Category:** Support & Discussions\
**Tags:** eeg, visualization\
**Created:** [January 23, 2025, 8:55am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730 "2025-01-23T08:55:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jiang](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@Jiang](https://mne.discourse.group/u/Jiang)\
**Post date:** [January 23, 2025, 8:55am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730/1 "2025-01-23T08:55:18Z")

</div>

- MNE version: e.g. 1.9.0
- operating system: e.g. Windows 11

The following is my codes:

```python
# 假设你的数据存放路径
datadir = './Web/datas'

data = np.load(os.path.join(datadir, 'sub1.npy'))
# 读取电极名称数据
electrode_data = pd.read_excel(os.path.join(datadir, 'channel-order.xlsx'), header=None)
# 将电极名称列表转为一个列表
electrode_names = electrode_data[0].tolist()

# 数据的形状
n_blocks, n_channels, n_samples = data.shape
sfreq = 200 # 采样频率

# 创建 info 字典
ch_names = [electrode_names[i] for i in range(n_channels)]
info = create_info(ch_names=ch_names, sfreq=sfreq, ch_types='eeg')

# 将所有块的数据拼接到一起
data_combined = data.reshape(n_channels, -1) # (n_channels, n_samples)

# 创建 RawArray
montage = mne.channels.make_standard_montage('standard_1005')
raw = RawArray(data_combined, info)
raw.set_montage(montage, match_case=False, match_alias=True)

psd = raw.compute_psd()
psd.plot_topo()

raw.plot_sensors(ch_type='eeg', show_names=True)

#绘制ICA成分地形图
ica = mne.preprocessing.ICA(n_components=12, random_state=97, max_iter=800)
ica.fit(inst=raw)
ica.plot_components()
plt.show()

```

My data only has 62 channels. From the forum, I learned that I can use `match_case=False, match_alias=True`  
to match the electrode positions of `standard_1005`, but the generated image has an offset and is shifted upwards.  
This is the plot image:

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/f/f1cc26526c7f502022fab5472cab8213137463cc.png)

---

<div class="post-metadata">

**Author:** ![Jiang](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@Jiang](https://mne.discourse.group/u/Jiang)\
**Post date:** [January 23, 2025, 9:01am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730/2 "2025-01-23T09:01:48Z")

</div>

I think I have solved it!  
I should add `sphere="eeglab"` to the line `raw.plot_sensors(ch_type='eeg', show_names=True)`

---

<div class="post-metadata">

**Author:** ![Jiang](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@Jiang](https://mne.discourse.group/u/Jiang)\
**Post date:** [January 23, 2025, 9:03am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730/3 "2025-01-23T09:03:02Z")

</div>

I don’t know if this is the correct solution.

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [January 23, 2025, 10:09am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730/4 "2025-01-23T10:09:04Z")

</div>

You might want to try `"biosemi64"` instead of `"standard_1005"`. The reason is that the former contains idealized locations, whereas the latter contains actual measured locations AFAIK. Otherwise, as you’ve already mentioned, you can play around with the `sphere` argument to set the head origin.

---

<div class="post-metadata">

**Author:** ![Jiang](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@Jiang](https://mne.discourse.group/u/Jiang)\
**Post date:** [January 24, 2025, 2:08am UTC](https://mne.discourse.group/t/i-noticed-that-the-electrode-positions-are-offset-when-using-plot-sensors/10730/6 "2025-01-24T02:08:18Z")

</div>

I tried `‘biosemi64’` and error ocurred:

```python
’
Traceback (most recent call last):
File “D:\Desktop\多模态脑电信号\Web\data_process.py”, line 35, in
raw.set_montage(montage, match_case=False, match_alias=True)
File “”, line 12, in set_montage
File “C:\Users\22801\AppData\Local\Programs\Python\Python312\Lib\site-packages\mne_fiff\meas_info.py”, line 422, in set_montage
_set_montage(info, montage, match_case, match_alias, on_missing)
File “C:\Users\22801\AppData\Local\Programs\Python\Python312\Lib\site-packages\mne\channels\montage.py”, line 1250, in _set_montage
_on_missing(on_missing, missing_coord_msg)
File “C:\Users\22801\AppData\Local\Programs\Python\Python312\Lib\site-packages\mne\utils\check.py”, line 1191, in _on_missing
raise error_klass(msg)
ValueError: DigMontage is only a subset of info. There are 4 channel positions not present in the DigMontage. The channels missing from the montage are:

[‘PO5’, ‘PO6’, ‘CB1’, ‘CB2’].

Consider using inst.rename_channels to match the montage nomenclature, or inst.set_channel_types if these are not EEG channels, or use the on_missing parameter if the channel positions are allowed to be unknown in your analyses.

```
