alphapepttools.pl.BasePalettes#

class alphapepttools.pl.BasePalettes#

Discrete color palettes for alphapepttools plots

Provides access to curated discrete color palettes optimized for categorical data visualization. Palettes can be retrieved by name and will cycle to provide the requested number of colors.

default_palettes#

Dictionary of available palettes: ‘qualitative_spectral’ - Spectral-based palette with maximum separability ‘qualitative’ - Perceptually uniform palette from cmcrameri ‘binary’ - Two-color palette for binary data

Type:

dict

Attributes table#

Methods table#

get(palette_name[, n])

Retrieve a color palette by name with specified number of colors

Attributes#

BasePalettes.default_palettes: ClassVar[dict] = {'binary': [(np.float64(0.973424), np.float64(0.635183), np.float64(0.492547), np.float64(1.0)), (np.float64(0.210863), np.float64(0.411761), np.float64(0.677651), np.float64(1.0))], 'qualitative': [(np.float64(0.005193), np.float64(0.098238), np.float64(0.349842), np.float64(1.0)), (np.float64(0.3527320883209577), np.float64(0.5252643543147425), np.float64(0.3500992456852575), np.float64(1.0)), (np.float64(0.950697), np.float64(0.616649), np.float64(0.428624), np.float64(1.0)), (np.float64(0.1371330843115639), np.float64(0.5394965873001376), np.float64(0.774012015688436), np.float64(1.0)), (np.float64(0.7512112748053009), np.float64(0.7507543590002965), np.float64(0.34197302519469897), np.float64(1.0)), (np.float64(0.9906022999999998), np.float64(0.6199957000000004), np.float64(0.6260940000000003), np.float64(1.0)), (np.float64(0.24930604876563556), np.float64(0.7018865443807503), np.float64(0.7095790512343644), np.float64(1.0)), (np.float64(0.754268), np.float64(0.565033), np.float64(0.21176099999999998), np.float64(1.0)), (np.float64(0.981354), np.float64(0.8004059999999998), np.float64(0.9812670000000001), np.float64(1.0))], 'qualitative_spectral': [(np.float64(0.6196078431372549), np.float64(0.00392156862745098), np.float64(0.25882352941176473), np.float64(1.0)), (np.float64(0.3600153787004998), np.float64(0.7161860822760476), np.float64(0.6655132641291811), np.float64(1.0)), (np.float64(0.21299500192233756), np.float64(0.5114186851211072), np.float64(0.730795847750865), np.float64(1.0)), (np.float64(0.9330257593233372), np.float64(0.3913110342176086), np.float64(0.27197231833910035), np.float64(1.0)), (np.float64(0.9964628988850441), np.float64(0.8903498654363707), np.float64(0.31410995770857375), np.float64(1.0)), (np.float64(0.8513187235678585), np.float64(0.3757477893118031), np.float64(0.44384467512495146), np.float64(1.0)), (np.float64(0.5910034602076126), np.float64(0.835524798154556), np.float64(0.6442906574394464), np.float64(1.0)), (np.float64(0.42750951317466845), np.float64(0.6612885093204082), np.float64(0.8331440815965734), np.float64(1.0)), (np.float64(0.9817762399077278), np.float64(0.6073817762399076), np.float64(0.3457900807381776), np.float64(1.0))]}#

Methods#

classmethod BasePalettes.get(palette_name, n=9)#

Retrieve a color palette by name with specified number of colors

Retrieves palettes from the default palette collection or matplotlib colormaps. Automatically cycles the palette to provide the requested number of colors.

Parameters:
  • palette_name (str) – Name of palette from default_palettes or matplotlib colormap name.

  • n (int, default=9) – Number of colors to return. Palette will cycle if n exceeds palette length.

Return type:

list

Returns:

list List of n RGBA color tuples.

Examples

Get a default palette:

from alphapepttools.pl.colors import BasePalettes

colors = BasePalettes.get("qualitative", n=5)
# Returns 5 colors from the qualitative palette

Get a palette from matplotlib:

colors = BasePalettes.get("viridis", n=10)
# Retrieves 10 colors from the viridis colormap

Get binary colors for two groups:

colors = BasePalettes.get("binary", n=2)
# Returns 2 high-contrast colors