Skip to content
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

MRG: TimeViewer matplotlib figure color #7925

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion mne/viz/_brain/_timeviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ def update_plot(self):
framealpha=0.5, handlelength=1.)
self.canvas.draw()

def set_color(self, bg_color, fg_color):
"""Set the widget colors."""
self.axes.set_facecolor(bg_color)
self.axes.xaxis.label.set_color(fg_color)
self.axes.yaxis.label.set_color(fg_color)
self.axes.spines['top'].set_color(fg_color)
self.axes.spines['bottom'].set_color(fg_color)
self.axes.spines['left'].set_color(fg_color)
self.axes.spines['right'].set_color(fg_color)
self.axes.tick_params(axis='x', colors=fg_color)
self.axes.tick_params(axis='y', colors=fg_color)
self.fig.patch.set_facecolor(bg_color)

def show(self):
"""Show the canvas."""
self.canvas.show()
Expand Down Expand Up @@ -802,6 +815,10 @@ def configure_point_picking(self):
vlayout.addWidget(self.mpl_canvas.canvas)
vlayout.setStretch(0, 2)
vlayout.setStretch(1, 1)
self.mpl_canvas.set_color(
bg_color=self.brain._bg_color,
fg_color=self.brain._fg_color,
)
self.mpl_canvas.show()

# get brain data
Expand Down Expand Up @@ -1064,7 +1081,7 @@ def plot_time_line(self):
self.time_line = self.mpl_canvas.plot_time_line(
x=current_time,
label='time',
color='black',
color=self.brain._fg_color,
lw=1,
)
else:
Expand Down