Skip to content

Commit

Permalink
ENH ClusterPlotter.plot_values(): option to suppress legend (default)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Feb 4, 2017
1 parent e263693 commit 2fcaa99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions eelbrain/_result_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _get_data(self, model, sub, subagg):

def plot_values(self, ids, model, ymax, ymin, dpi=300, sub=None,
subagg=None, cells=None, pairwise=False, colors=None,
prefix=None, w=None, filter=None):
prefix=None, w=None, filter=None, legend=False):
"""Plot values in cluster
Parameters
Expand Down Expand Up @@ -282,6 +282,8 @@ def plot_values(self, ids, model, ymax, ymin, dpi=300, sub=None,
UTS-stat plot width (default is ``2 * h``).
filter : Filter
Filter signal for display purposes (optional).
legend : bool
Plot a color legend.
"""
if w is None:
w = self.h * 2
Expand All @@ -291,7 +293,6 @@ def plot_values(self, ids, model, ymax, ymin, dpi=300, sub=None,
colors = self.colors

src = ds['srcm']
legend_done = False
n_cells = len(ds.eval(model).cells)
w_bar = (n_cells * 2 + 4) * (self.h / 12)
with mpl.rc_context(self.rc):
Expand Down Expand Up @@ -330,8 +331,8 @@ def plot_values(self, ids, model, ymax, ymin, dpi=300, sub=None,
dpi=dpi, transparent=True)
p.close()

# legend
if not legend_done:
# legend (only once)
if legend:
p.save_legend(self._dst_vec % (modelname + ' legend'),
transparent=True)
legend_done = True
legend = False

0 comments on commit 2fcaa99

Please sign in to comment.