-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: viz plot window's 'title' argument showed no effect. #12828
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed behavior of :func:`mne.viz.plot_source_estimates` where the ``title`` was not displayed properly, by :newcontrib:`Shristi Baral`. |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2321,6 +2321,7 @@ def plot_source_estimates( | |||||||||||
transparent=True, | ||||||||||||
alpha=1.0, | ||||||||||||
time_viewer="auto", | ||||||||||||
*, | ||||||||||||
subjects_dir=None, | ||||||||||||
figure=None, | ||||||||||||
views="auto", | ||||||||||||
|
@@ -2430,8 +2431,7 @@ def plot_source_estimates( | |||||||||||
Defaults to 'oct6'. | ||||||||||||
|
||||||||||||
.. versionadded:: 0.15.0 | ||||||||||||
title : str | None | ||||||||||||
Title for the figure. If None, the subject name will be used. | ||||||||||||
%(title_stc)s | ||||||||||||
|
||||||||||||
.. versionadded:: 0.17.0 | ||||||||||||
%(show_traces)s | ||||||||||||
|
@@ -2510,6 +2510,7 @@ def plot_source_estimates( | |||||||||||
view_layout=view_layout, | ||||||||||||
add_data_kwargs=add_data_kwargs, | ||||||||||||
brain_kwargs=brain_kwargs, | ||||||||||||
title=title, | ||||||||||||
**kwargs, | ||||||||||||
) | ||||||||||||
|
||||||||||||
|
@@ -2545,6 +2546,7 @@ def _plot_stc( | |||||||||||
view_layout, | ||||||||||||
add_data_kwargs, | ||||||||||||
brain_kwargs, | ||||||||||||
title, | ||||||||||||
): | ||||||||||||
from ..source_estimate import _BaseVolSourceEstimate | ||||||||||||
from .backends.renderer import _get_3d_backend, get_brain_class | ||||||||||||
|
@@ -2587,7 +2589,12 @@ def _plot_stc( | |||||||||||
if overlay_alpha == 0: | ||||||||||||
smoothing_steps = 1 # Disable smoothing to save time. | ||||||||||||
|
||||||||||||
title = subject if len(hemis) > 1 else f"{subject} - {hemis[0]}" | ||||||||||||
sub_info = subject if len(hemis) > 1 else f"{subject} - {hemis[0]}" | ||||||||||||
if not title: | ||||||||||||
title = sub_info | ||||||||||||
else: | ||||||||||||
title = f"{title}, {sub_info}" | ||||||||||||
Comment on lines
+2593
to
+2596
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the right behavior. I don't like that there is no way to prevent subject name from appearing. One concrete case where you don't want to show it: if your subject names aren't de-identified, and you want to show an STC plot in a public presentation/demo. Most (all?) other places in our codebase, if we have some sort of default/automatic title when
Suggested change
|
||||||||||||
|
||||||||||||
kwargs = { | ||||||||||||
"subject": subject, | ||||||||||||
"hemi": hemi, | ||||||||||||
|
@@ -3220,6 +3227,7 @@ def plot_vector_source_estimates( | |||||||||||
vector_alpha=1.0, | ||||||||||||
scale_factor=None, | ||||||||||||
time_viewer="auto", | ||||||||||||
*, | ||||||||||||
subjects_dir=None, | ||||||||||||
figure=None, | ||||||||||||
views="lateral", | ||||||||||||
|
@@ -3231,6 +3239,7 @@ def plot_vector_source_estimates( | |||||||||||
foreground=None, | ||||||||||||
initial_time=None, | ||||||||||||
time_unit="s", | ||||||||||||
title=None, | ||||||||||||
show_traces="auto", | ||||||||||||
src=None, | ||||||||||||
volume_options=1.0, | ||||||||||||
|
@@ -3308,6 +3317,9 @@ def plot_vector_source_estimates( | |||||||||||
time_unit : 's' | 'ms' | ||||||||||||
Whether time is represented in seconds ("s", default) or | ||||||||||||
milliseconds ("ms"). | ||||||||||||
%(title_stc)s | ||||||||||||
|
||||||||||||
.. versionadded:: 1.9 | ||||||||||||
%(show_traces)s | ||||||||||||
%(src_volume_options)s | ||||||||||||
%(view_layout)s | ||||||||||||
|
@@ -3354,6 +3366,7 @@ def plot_vector_source_estimates( | |||||||||||
cortex=cortex, | ||||||||||||
foreground=foreground, | ||||||||||||
size=size, | ||||||||||||
title=title, | ||||||||||||
scale_factor=scale_factor, | ||||||||||||
show_traces=show_traces, | ||||||||||||
src=src, | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this controls window title (in the GUI titlebar), not figure title (text on the figure image itself). So this text should be clarified, and also be more clear that the passed
title
will be prepended to the subject name. However, see other comment below; I'm not convinced that is the right behavior.