Diverging HSV Color Palettes

Description

diverging_hsv provides an HSV-based version of diverging_hcl. Its purpose is mainly didactic to show that HSV-based diverging palettes are less appealing, more difficult to read and more flashy than HCL-based diverging palettes.

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

Usage

diverging_hsv(h=[240, 0], s=1.0, v=1.0, power=1.0,
fixup=True, rev=False, *args,
**kwargs)

Arguments

hlist of numerics
Hue values, diverging color palettes should have different hues for both ends of the palette. If only one value is present it will be recycled ending up in a diverging color palette with the same colors on both ends. If more than two values are provided the first two will be used while the rest is ignored. If input h is a str this argument acts like the palette argument (see palette input parameter).
sfloat, int
Saturation value for the two ends of the palette.
vfloat, int
Value (the HSV value) of the colors.
powernumeric
Power parameter for non-linear behaviour of the color palette.
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, s, v.

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

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

Examples

from colorspace import diverging_hsv
pal = diverging_hsv()
pal.colors(10)
['#0000FF',
 '#8282FF',
 '#B2B2FF',
 '#D5D5FF',
 '#F2F2FF',
 '#FFF2F2',
 '#FFD5D5',
 '#FFB2B2',
 '#FF8282',
 '#FF0000']
pal.swatchplot(show_names = False, figsize = (5.5, 0.5));

# The standard call of the object also returns hex colors
diverging_hsv()(10)
['#0000FF',
 '#8282FF',
 '#B2B2FF',
 '#D5D5FF',
 '#F2F2FF',
 '#FFF2F2',
 '#FFD5D5',
 '#FFB2B2',
 '#FF8282',
 '#FF0000']
# Manually modified palette from 'cyan' to 'orange'
diverging_hsv(h = [180, 30]).swatchplot(
              n = 7, show_names = False, figsize = (5.5, 0.5))

# Additionally, lower saturation on the two ends
diverging_hsv(h = [180, 30], s = 0.4).swatchplot(
              n = 7, show_names = False, figsize = (5.5, 0.5))

# Lowering the value
diverging_hsv(h = [180, 30], s = 0.4, v = 0.75).swatchplot(
              n = 7, show_names = False, figsize = (5.5, 0.5))