HCL Based Terrain Color Palette

Description

terrain_hcl is an implementation of the base R ‘terrain.colors’ palette but constructed in HCL space based on a call to sequential_hcl.

See also: qualitative_hcl, sequential_hcl, diverging_hcl, divergingx_hcl, rainbow_hcl, heat_hcl, diverging_hsv, and rainbow.

Usage

terrain_hcl(h=[130, 0], c=[80, 0], l=[60, 95],
power=[0.1, 1.0], fixup=True, rev=False,
*args, **kwargs)

Arguments

hlist of int
Hue parameters (h1/h2).
clist of int
Chroma parameters (c1/c2).
lint
Luminance parameters (l1/l2).
powerlist of float
Power parameters (p1/p2).
fixupbool
Only used when converting the HCL colors to hex. Should RGB values outside the defined RGB color space be corrected?
revbool
Should the color map be reversed.
*args
unused.
**kwargs
Additional arguments to overwrite the h/c/l settings. Allowed: h1, h2, c1, c2, l1, l2, p1, p2.

Return

Initialize new object, no return. Raises a set of errors if the parameters are misspecified. Note that the object is callable, the default object call can be used to return hex colors (identical to the .colors() method), see examples.

Methods

terrain_hcl.cmap(n=256, name='custom_hcl_cmap')
Create Matplotlib Compatible Color Map
terrain_hcl.colors(n=11, fixup=None, alpha=None, **kwargs)
Get Colors
terrain_hcl.get(key)
Get Specific Palette Setting
terrain_hcl.hclplot(n=7, **kwargs)
Palette Plot in HCL Space
terrain_hcl.name()
Get Palette Name
terrain_hcl.show_settings()
Show Palette Settings
terrain_hcl.specplot(n=180, *args, **kwargs)
Color Spectrum Plot
terrain_hcl.swatchplot(n=7, **kwargs)
Palette Swatch Plot

Examples

from colorspace import terrain_hcl
pal = terrain_hcl()
pal.colors(10)
['#26A63A',
 '#68AC20',
 '#92B106',
 '#B4B61A',
 '#D3BA3D',
 '#EFBD60',
 '#FFC183',
 '#FFC6A7',
 '#FFCDC9',
 '#F1F1F1']
pal.swatchplot(show_names = False, figsize = (5.5, 0.5));

# The standard call of the object also returns hex colors
terrain_hcl()(10)
['#26A63A',
 '#68AC20',
 '#92B106',
 '#B4B61A',
 '#D3BA3D',
 '#EFBD60',
 '#FFC183',
 '#FFC6A7',
 '#FFCDC9',
 '#F1F1F1']