---
title: "Diverging HSV Color Palettes"
---

### Description

`diverging_hsv` provides an HSV-based version of [diverging_hcl](colorspace.palettes.diverging_hcl.qmd).
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](colorspace.palettes.qualitative_hcl.qmd), [sequential_hcl](colorspace.palettes.sequential_hcl.qmd),
[diverging_hcl](colorspace.palettes.diverging_hcl.qmd), [divergingx_hcl](colorspace.palettes.divergingx_hcl.qmd),
[rainbow_hcl](colorspace.palettes.rainbow_hcl.qmd), [heat_hcl](colorspace.palettes.heat_hcl.qmd), [terrain_hcl](colorspace.palettes.terrain_hcl.qmd), and
[rainbow](colorspace.palettes.rainbow.qmd).

### Usage

<pre><code class='language-python'>diverging_hsv(h=[240, 0], s=1.0, v=1.0, power=1.0,<br/>              fixup=True, rev=False, *args,<br/>              **kwargs)</code></pre>

### Arguments

<dl class="pyp-list param-list">
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:h">h</code><code class="argument-class">list of numerics</code>
  </dt>
 <dd>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).</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:s">s</code><code class="argument-class">float, int</code>
  </dt>
 <dd>Saturation value for the two ends of the palette.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:v">v</code><code class="argument-class">float, int</code>
  </dt>
 <dd>Value (the HSV value) of the colors.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:power">power</code><code class="argument-class">numeric</code>
  </dt>
 <dd>Power parameter for non-linear behaviour of the color
palette.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:fixup">fixup</code><code class="argument-class">bool</code>
  </dt>
 <dd>Only used when converting the HCL colors to hex.  Should
RGB values outside the defined RGB color space be corrected?</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:rev">rev</code><code class="argument-class">bool</code>
  </dt>
 <dd>Should the color map be reversed.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:*args">*args</code>
  </dt>
 <dd>Unused.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.diverging_hsv:**kwargs">**kwargs</code>
  </dt>
 <dd>Additional arguments to overwrite the h/c/l settings.
Allowed: `h1`, `h2`, `s`, `v`.</dd>
</dl>

### 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

<dl class="pyp-list method-list">
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.cmap(n=256, name=&#x27;custom_hcl_cmap&#x27;)](colorspace.palettes.diverging_hsv.cmap.qmd)</code>
    </dt>
    <dd>Create Matplotlib Compatible Color Map</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.colors(n=11, fixup=None, alpha=None, **kwargs)](colorspace.palettes.diverging_hsv.colors.qmd)</code>
    </dt>
    <dd>Get Colors</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.get(key)](colorspace.palettes.diverging_hsv.get.qmd)</code>
    </dt>
    <dd>Get Specific Palette Setting</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.hclplot(n=7, **kwargs)](colorspace.palettes.diverging_hsv.hclplot.qmd)</code>
    </dt>
    <dd>Palette Plot in HCL Space</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.name()](colorspace.palettes.diverging_hsv.name.qmd)</code>
    </dt>
    <dd>Get Palette Name</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.show_settings()](colorspace.palettes.diverging_hsv.show_settings.qmd)</code>
    </dt>
    <dd>Show Palette Settings</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.specplot(n=180, *args, **kwargs)](colorspace.palettes.diverging_hsv.specplot.qmd)</code>
    </dt>
    <dd>Color Spectrum Plot</dd>
    <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
       <code>[diverging_hsv.swatchplot(n=7, **kwargs)](colorspace.palettes.diverging_hsv.swatchplot.qmd)</code>
    </dt>
    <dd>Palette Swatch Plot</dd>
</dl>


### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
from colorspace import diverging_hsv
pal = diverging_hsv()
pal.colors(10)
```

```{python}
#| echo: true
#| warning: true
#| error: true
pal.swatchplot(show_names = False, figsize = (5.5, 0.5));
```

```{python}
#| echo: true
#| warning: true
#| error: true
# The standard call of the object also returns hex colors
diverging_hsv()(10)
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Manually modified palette from 'cyan' to 'orange'
diverging_hsv(h = [180, 30]).swatchplot(
              n = 7, show_names = False, figsize = (5.5, 0.5))
```

```{python}
#| echo: true
#| warning: true
#| error: true
# 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))
```

```{python}
#| echo: true
#| warning: true
#| error: true
# 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))
```



