Skip to content

Commit

Permalink
MRG: TimeViewer matplotlib figure color (#7925)
Browse files Browse the repository at this point in the history
* Update internal matplotlib figure color palette

* Update time line
  • Loading branch information
GuillaumeFavelier authored Jun 25, 2020
1 parent 4353b2c commit dfcbd29
Showing 1 changed file with 18 additions and 1 deletion.
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

0 comments on commit dfcbd29

Please sign in to comment.