Skip to content

Commit 82b016a

Browse files
Fix time support
1 parent 8cd379a commit 82b016a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

mne/viz/_brain/_brain.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,14 @@ def time_label(x):
395395
self._data["time_label"] = time_label
396396
y_txt = 0.05 + 0.1 * bool(colorbar)
397397

398-
if time is not None and len(array.shape) == 2:
398+
if time is not None and len(array.shape) == 2 and array.shape[1] > 1:
399399
# we have scalar_data with time dimension
400400
act_data, act_time = self._interpolate_data(array, time_idx)
401401
self._current_time = act_time
402402
else:
403403
# we have scalar data without time
404404
act_data = array
405+
self._current_time = None
405406

406407
fmin, fmid, fmax = _update_limits(
407408
fmin, fmid, fmax, center, array
@@ -472,8 +473,8 @@ def time_label(x):
472473
actor, mesh = mesh_data, None
473474
self._data[hemi]['actor'].append(actor)
474475
self._data[hemi]['mesh'].append(mesh)
475-
if array.ndim >= 2 and callable(time_label):
476-
if not self._time_label_added:
476+
if array.ndim >= 2 and self._current_time is not None:
477+
if not self._time_label_added and callable(time_label):
477478
time_actor = self._renderer.text2d(
478479
x_window=0.95, y_window=y_txt,
479480
size=time_label_size,

0 commit comments

Comments
 (0)