Skip to content

Commit

Permalink
Taking a screenshot with _TimeViewer (#7527)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
GuillaumeFavelier and larsoner authored Mar 27, 2020
1 parent c38ccb7 commit 9ca6b11
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/inverse/plot_psf_ctf_vertices_lcmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
brain_post.add_text(0.1, 0.9, 'LCMV beamformer with post-stimulus\ndata '
'covariance matrix', 'title', font_size=16)

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

Expand Down
10 changes: 6 additions & 4 deletions examples/visualization/plot_publication_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
evoked.plot()

stc.plot(views='lat', hemi='split', size=(800, 400), subject='sample',
subjects_dir=subjects_dir, initial_time=max_t)
subjects_dir=subjects_dir, initial_time=max_t,
time_viewer=False, show_traces=False)

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

# Plot the STC, get the brain image, crop it
# Plot the STC, get the brain image, crop it:
brain = stc.plot(views='lat', hemi='split', size=(800, 400), subject='sample',
subjects_dir=subjects_dir, initial_time=max_t,
background='w', colorbar=False, clim=clim, colormap=colormap)
subjects_dir=subjects_dir, initial_time=max_t, background='w',
colorbar=False, clim=clim, colormap=colormap,
time_viewer=False, show_traces=False)
screenshot = brain.screenshot()
brain.close()

Expand Down
10 changes: 5 additions & 5 deletions mne/viz/_brain/_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ def __init__(self, subject_id, hemi, surf, title=None,

if figure is not None and not isinstance(figure, int):
backend._check_3d_figure(figure)
self._renderer = _get_renderer(name=subject_id, size=fig_size,
if title is None:
self._title = subject_id
else:
self._title = title
self._renderer = _get_renderer(name=self._title, size=fig_size,
bgcolor=background,
shape=(n_row, n_col),
fig=figure)
Expand Down Expand Up @@ -238,10 +242,6 @@ def __init__(self, subject_id, hemi, surf, title=None,
self._renderer.set_camera(azimuth=views_dict[v].azim,
elevation=views_dict[v].elev)

if self._title is not None:
backend._set_3d_title(figure=self._renderer.scene(),
title=self._title)

# Force rendering
self._renderer.show()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
evoked.plot_topomap(times=np.linspace(0.05, 0.15, 5), ch_type='mag',
time_unit='s')

# Show whitening
# Show whitening:
evoked.plot_white(noise_cov, time_unit='s')

del epochs, raw # to save memory
Expand Down

0 comments on commit 9ca6b11

Please sign in to comment.