colors
Utilities for manipulating colors.
BNF
<sequence-color-spec> ::= { "A": <color-spec>, "C": <color-spec>, "G": <color-spec>, "T": <color-spec> }
<color-spec> ::= {"rgb": [<number>, <number>, <number>]} | {"rgba": [<number>, <number>, <number>, <number>]} | {"tol": <integer>} | {"tol-light": <integer>} | {"ibm": <integer>} | {"wong": <integer>} | [<number>, <number>, <number>«, <number>»]
<list-of-sequence-color-spec> ::= <sequence-color-spec>«, <list-of-sequence-color-spec>»
<list-of-color-spec> ::= <color-spec>«, <list-of-color-spec>»
- bpreveal.colors.tol: tuple[tuple[float, float, float] | tuple[float, float, float, float], ...]
The muted color scheme by Paul Tol.
- Type:
tuple[
RGB_T, …]
- bpreveal.colors.ibm: tuple[tuple[float, float, float] | tuple[float, float, float, float], ...]
The IBM design library’s color blind palette.
- Type:
tuple[
RGB_T, …]
- bpreveal.colors.wong: tuple[tuple[float, float, float] | tuple[float, float, float, float], ...]
Bang Wong’s palette. Used for DNA.
- Type:
tuple[
RGB_T, …]
- bpreveal.colors.tolLight: tuple[tuple[float, float, float] | tuple[float, float, float, float], ...]
The light color scheme by Paul Tol, but with light blue and olive deleted.
- Type:
tuple[
RGB_T, …]
- bpreveal.colors.dnaWong: DNA_COLOR_SPEC_T = {'A': {'wong': 3}, 'C': {'wong': 5}, 'G': {'wong': 4}, 'T': {'wong': 6}}
The default color map for DNA bases.
A is green, C is blue, G is yellow, and T is red.
- bpreveal.colors.defaultProfile: dict[Literal['rgb'], tuple[float, float, float]] | dict[Literal['rgba'], tuple[float, float, float, float]] | dict[Literal['tol'], int] | dict[Literal['tol-light'], int] | dict[Literal['ibm'], int] | dict[Literal['wong'], int] | tuple[float, float, float] | tuple[float, float, float, float]
The default color for profile plots. It’s tol[0].
- Type:
- bpreveal.colors.pisaClip = <matplotlib.colors.ListedColormap object>
The color map used for PISA plots, including green and pink clipping colors.
- bpreveal.colors.pisaNoClip = <matplotlib.colors.ListedColormap object>
The color map for PISA plots but without the clipping warning colors.
- bpreveal.colors.parseSpec(colorSpec)
Given a color-spec (See the BNF), convert it into an rgb or rgba tuple.
- Parameters:
colorSpec (
COLOR_SPEC_T| str) – The color specification.- Returns:
An rgb triple (or rgba quadruple).
- Return type:
tuple[float, float, float] | tuple[float, float, float, float]
Based on the shape of colorSpec, this function interprets it differently. If colorSpec is a…
- 3-tuple
it is interpreted as an rgb color,
- 4-tuple
it is interpreted as rgba,
{"rgb": (0.1, 0.2, 0.3)}it is interpreted as an rgb color,
{"rgba": (0.1, 0.2, 0.3, 0.8)}it is interpreted as an rgba color,
{"<palette-name>": 3}where
<palette-name>is one of “tol”, “tol-light”, “wong”, or “ibm”), then the value is the coloriin the corresponding palette."b"or any other string, then it is interpreted as a matplotlib color string and is passed to
matplotlib.colors.to_rgb.
- bpreveal.colors.loadFonts()
Configures the matplotlib default fonts to be in the Libertinus family.
This places Libertinus fonts at the top of the order for serif and sans-serif fontfamily, but does not overwrite the monospace family.
- Return type:
None