Skip to content

Commit 9ca6b11

Browse files
Taking a screenshot with _TimeViewer (#7527)
* Wrap brain screenshot * FIX: Mailmap and authors * Copy doc from brain.screenshot * Touch plot_publication_figure * Revert "Copy doc from brain.screenshot" This reverts commit bd62f5f. * Revert "Wrap brain screenshot" This reverts commit 88d30d3. * Disable time_viewer for plot_publication * Fix title bug * Touch plot_psf_ctf_vertices_lcmv * Touch plot_mne_dspm_source_localization * Set show_traces=False in plot_publication_figure Co-authored-by: Eric Larson <[email protected]>
1 parent c38ccb7 commit 9ca6b11

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

examples/inverse/plot_psf_ctf_vertices_lcmv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
brain_post.add_text(0.1, 0.9, 'LCMV beamformer with post-stimulus\ndata '
125125
'covariance matrix', 'title', font_size=16)
126126

127-
# Mark true source location for CTFs
127+
# mark true source location for CTFs
128128
brain_pre.add_foci(verttrue, coords_as_verts=True, scale_factor=1., hemi='lh',
129129
color='green')
130130

examples/visualization/plot_publication_figure.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
evoked.plot()
4545

4646
stc.plot(views='lat', hemi='split', size=(800, 400), subject='sample',
47-
subjects_dir=subjects_dir, initial_time=max_t)
47+
subjects_dir=subjects_dir, initial_time=max_t,
48+
time_viewer=False, show_traces=False)
4849

4950
###############################################################################
5051
# To make a publication-ready figure, first we'll re-plot the brain on a white
@@ -55,10 +56,11 @@
5556
colormap = 'viridis'
5657
clim = dict(kind='value', lims=[4, 8, 12])
5758

58-
# Plot the STC, get the brain image, crop it
59+
# Plot the STC, get the brain image, crop it:
5960
brain = stc.plot(views='lat', hemi='split', size=(800, 400), subject='sample',
60-
subjects_dir=subjects_dir, initial_time=max_t,
61-
background='w', colorbar=False, clim=clim, colormap=colormap)
61+
subjects_dir=subjects_dir, initial_time=max_t, background='w',
62+
colorbar=False, clim=clim, colormap=colormap,
63+
time_viewer=False, show_traces=False)
6264
screenshot = brain.screenshot()
6365
brain.close()
6466

mne/viz/_brain/_brain.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ def __init__(self, subject_id, hemi, surf, title=None,
200200

201201
if figure is not None and not isinstance(figure, int):
202202
backend._check_3d_figure(figure)
203-
self._renderer = _get_renderer(name=subject_id, size=fig_size,
203+
if title is None:
204+
self._title = subject_id
205+
else:
206+
self._title = title
207+
self._renderer = _get_renderer(name=self._title, size=fig_size,
204208
bgcolor=background,
205209
shape=(n_row, n_col),
206210
fig=figure)
@@ -238,10 +242,6 @@ def __init__(self, subject_id, hemi, surf, title=None,
238242
self._renderer.set_camera(azimuth=views_dict[v].azim,
239243
elevation=views_dict[v].elev)
240244

241-
if self._title is not None:
242-
backend._set_3d_title(figure=self._renderer.scene(),
243-
title=self._title)
244-
245245
# Force rendering
246246
self._renderer.show()
247247

tutorials/source-modeling/plot_mne_dspm_source_localization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
evoked.plot_topomap(times=np.linspace(0.05, 0.15, 5), ch_type='mag',
5858
time_unit='s')
5959

60-
# Show whitening
60+
# Show whitening:
6161
evoked.plot_white(noise_cov, time_unit='s')
6262

6363
del epochs, raw # to save memory

0 commit comments

Comments
 (0)