eelbrain.plot.colors_for_oneway
- eelbrain.plot.colors_for_oneway(cells, hue_start=0.2, light_range=0.5, cmap=None, light_cycle=None, always_cycle_hue=False, locations=None, unambiguous=None)
Define colors for a single factor design
- Parameters
cells (sequence of str) – Cells for which to assign colors.
hue_start (Union[float, Sequence[float]]) – First hue value (
0 <= hue < 1
) or list of hue values.light_range (scalar | tuple of 2 scalar) – Scalar that specifies the amount of lightness variation (default 0.5). If positive, the first color is lightest; if negative, the first color is darkest. A tuple can be used to specify exact end-points (e.g.,
(1.0, 0.4)
).0.2
is equivalent to(0.4, 0.6)
. Thelight_cycle
parameter can be used to cycle between light and dark more than once.cmap (str) – Use a matplotlib colormap instead of the default color generation algorithm. Name of a matplotlib colormap to use (e.g., ‘jet’). If specified,
hue_start
andlight_range
are ignored.light_cycle (int) – Cycle from light to dark in
light_cycle
cells to make nearby colors more distinct (default cycles once).always_cycle_hue (bool) – Cycle hue even when cycling lightness. With
False
(default), hue is constant within a lightness cycle.locations (Sequence[float]) – Locations of the cells on the color-map (all in range [0, 1]; default is evenly spaced; example:
numpy.linspace(0, 1, len(cells)) ** 0.5
).unambiguous (Union[bool, Sequence[int]]) – Use unambiguos colors. If
True
, choose then
first colors; use a list ofint
to pick specific colors. Other parameters are ignored. For resources for constructing custom color palettes, see also: https://davidmathlogic.com/colorblind/.
- Return type
Mapping from cells to colors.