Skip to content

Commit

Permalink
AMD
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Nov 25, 2021
1 parent 0789ec5 commit f9a805c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions eelbrain/plot/_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ def find_cell_styles(
out = {None: colors}
elif isinstance(colors, (list, tuple)):
if len(colors) < len(cells):
raise ValueError(f"colors={colors!r}: only {len(colors)} colors for {len(cells)} cells.")
raise ValueError(f"{colors=}: only {len(colors)} colors for {len(cells)} cells.")
out = dict(zip(cells, colors))
elif isinstance(colors, dict):
out = colors.copy()
out = to_styles_dict(colors)
missing = [cell for cell in cells if cell not in out]
if missing:
if fallback:
Expand All @@ -182,6 +182,7 @@ def find_cell_styles(
break
if missing:
raise KeysMissing(missing, 'colors', colors)
return out
elif colors is None or isinstance(colors, str):
if default_cells is not None:
default_colors = find_cell_styles(default_cells, colors)
Expand Down Expand Up @@ -469,4 +470,4 @@ def soft_threshold_colormap(

ColorArg = Union[str, Sequence[float]]
ColorsArg = Union[ColorArg, Dict[CellArg, ColorArg], Sequence[ColorArg]]
StylesDict = Dict[CellArg, Style]
StylesDict = Dict[Optional[CellArg], Style]
2 changes: 1 addition & 1 deletion eelbrain/plot/tests/test_uts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_uts_stat():
assert p.figure.axes[1].get_title() == 'b1'
assert set(p._LegendMixin__handles) == {'a0', 'a1'}
p.close()
p = plot.UTSStat('uts', 'A', 'B', match='rm', ds=ds, pool_error=False)
p = plot.UTSStat('uts', 'A', 'B', match='rm', ds=ds, pool_error=False, colors={'a0': 'red', 'a1': 'k'})
assert [len(pl.stat_plots) for pl in p._plots] == [2, 2]
p.close()

Expand Down

0 comments on commit f9a805c

Please sign in to comment.