Skip to content

Commit

Permalink
ENH SequencePlotter: allow ndvars that only have data for one hemi
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Nov 26, 2021
1 parent d36d43c commit f1b8189
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions eelbrain/plot/_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,11 +1113,7 @@ def __post_init__(self):
assert self.index is None

def plot(self, brain):
if self.plot_type == SPPlotType.DATA:
brain.add_ndvar(self.data, *self.args, time_label='', **self.kwargs)
elif self.plot_type == SPPlotType.LABEL:
brain.add_ndvar_label(self.data, *self.args, **self.kwargs)
elif self.plot_type == SPPlotType.MNE_LABEL:
if self.plot_type == SPPlotType.MNE_LABEL:
if isinstance(self.data, mne.BiHemiLabel):
label = getattr(self.data, brain.hemi)
elif self.data.hemi == brain.hemi:
Expand All @@ -1128,6 +1124,14 @@ def plot(self, brain):
elif self.plot_type == SPPlotType.FUNC:
func = self.args[0]
func(brain)
elif len(self.data.source.vertices[brain.hemi == 'rh']) == 0:
return
elif self.plot_type == SPPlotType.DATA:
brain.add_ndvar(self.data, *self.args, time_label='', **self.kwargs)
elif self.plot_type == SPPlotType.LABEL:
brain.add_ndvar_label(self.data, *self.args, **self.kwargs)
else:
raise RuntimeError(f"{self.plot_type=}")


class SequencePlotter:
Expand Down

0 comments on commit f1b8189

Please sign in to comment.