brain plot add.foci


I’m trying to add a foci to a stc.plot() by using a coordinate, but no matter what coordinate I try, only a dot at (0,0,0) is plotted. Does anyone know how to solve this?


Hello @karin.westin85 and welcome to the forum!

Please ensure to use our topic template when asking for questions so others will, in fact, be able to help you. For reference, the template is the following:

If you have a question or issue with MNE-Python, please include the following info:

  • MNE-Python version: 0.xx.x
  • operating system:

Please also provide relevant code snippets – ideally a minimal working example (MWE). To get the correct formatting, paste your Python code, then select it, and click on the Preformatted text toolbar button.

:point_right: :point_right: :point_right: Please edit or remove the above text before submitting your posting. :point_left: :point_left: :point_left:


Sorry… MNE Python version 0.19.2
Operating system Ubuntu 18

This version of MNE is very old. Any chance you could install a more recent version (0.23)?

I updated to the latest version of MNE, but all added foci ends up at (0,0,0) nonetheless

here is an example that uses add_foci:

can you run this example on your machine to confirm if it works?


That works; adding foci as vertices works. It’s trying to add them as coordinates and setting coords_as_verts=False that doesn’t

can you share a full code snippet using mne sample dataset to replicate?


Please see code snippet below and output figure. Thanks! /Karin

import os.path as op
import numpy as np
import mne as mne
from mne.datasets import sample
import mayavi.mlab as mlab
from scipy.spatial import distance
from mne.minimum_norm import make_inverse_operator, apply_inverse

data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
subject = 'sample'

trans = None
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
subject = 'sample'

data_path = sample.data_path()
subjects_dir = data_path + '/subjects/'
fname_fwd = data_path + '/MEG/sample/sample_audvis-meg-eeg-oct-6-fwd.fif'
fname_cov = data_path + '/MEG/sample/sample_audvis-cov.fif'
fname_evo = data_path + '/MEG/sample/sample_audvis-ave.fif'
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'

fwd = mne.read_forward_solution(fname_fwd)

# Read raw data
raw =

noise_cov = mne.read_cov(fname_cov)

spEv = np.array([[6000,0,2],[7000,0,2]])	
picks = mne.pick_types(, meg=True, eeg=False)		
baseline = (None)
epch = mne.Epochs(raw, spEv, event_id=2,tmin=-.0,tmax=.1,#.17,#.37,
	baseline=baseline, preload=True, reject=None)

ev = epch.average()

inv_op = make_inverse_operator(, fwd, noise_cov, loose=.2, depth=.8)
method = 'MNE'
snr = 3
lambda2 = 1./snr**2
myMNE = apply_inverse(ev, inv_op, lambda2, method=method, pick_ori=None)

data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
subject = 'sample'

brain = myMNE.plot(subject='sample',surface='white',hemi='rh', initial_time=0, subjects_dir=subjects_dir,figure=1)			

loc = [ 0.5 ,0.5,  0.5]

I cannot reproduce. Here is a screenshot with both pyvista backend and mayavi backend, you’ll see I’ve added 2-4 foci on each:



The coordinates of the red sphere are (100, -50, 10), for reference, and the other colors values around (0,0,0), (1, -1, -1), etc.


have you tried to play with the magnitude of coordinates a bit? If I use

loc = [ 200, 0.5,  0.5]

I get the following result on MNE-Python 0.23:

I realised that when I saw Dan McCloys code… Multiplying all my coordinates by 100 magically moved all foci to where they should be…

Thank you!

1 Like

is the expected unit not well documented?


It seems only I had this issue so it’s probably just me

sön 12 sep. 2021 kl. 21:29 skrev Alexandre Gramfort via MNE Forum <>:

can you look at the docstring if it’s explicit enough. I would not be surprised if it’s not…


The documentation says “Coordinates in stereotaxic space”.


I saw that too and didn’t know what it means :sweat_smile::see_no_evil: We should at least add a reference to the docstring…

That’s a bit of a relief… I took it as my own ignorance that I didn’t really get that. I wanted to plot dipole and source space coordinates which come in the [-1,1] interval so might be a good idea to indicate that you need to change the scaling.


let’s open a PR to improve the docstring.


Please never hold back with feedback like this – if you don’t want to mention this publicly, feel free to send a private message to me or any other MNE-Python developer :slight_smile: Our users come from largely different areas and therefore it’s actually to be expected that was sounds super familiar to some is just confusing gibberish to others. We try to provide documentation that bridges this gap, but often we fail :see_no_evil: So your feedback is greatly appreciated!

Best wishes,