---
title: "Palette Swatch Plot"
---

### Description

Interfacing the main [swatchplot](colorspace.swatchplot.swatchplot.qmd)
function. Plotting the spectrum of the current color palette.

### Usage

<pre><code class='language-python'>rainbow_hcl.swatchplot(n=7, **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.rainbow_hcl.swatchplot:n">n</code><code class="argument-class">int</code>
  </dt>
 <dd>Number of colors, defaults to 7.</dd>
  <dt style = "white-space: nowrap; font-family: monospace; vertical-align: top">
   <code id="colorspace.palettes.rainbow_hcl.swatchplot:**kwargs">**kwargs</code>
  </dt>
 <dd>forwarded to [swatchplot](colorspace.swatchplot.swatchplot.qmd).</dd>
</dl>

### Examples

```{python}
#| echo: true
#| warning: true
#| error: true
# Exemplarily for diverging_hcl, works for
# all other HCL palettes as well.
from colorspace import diverging_hcl
pal = diverging_hcl()
pal.swatchplot(figsize = (8, 2))
```

```{python}
#| echo: true
#| warning: true
#| error: true
# Handing over a series of additional arguments
# forwarded to swatchplot()
pal.swatchplot(n = 21, figsize = (8, 2),
               show_names = False, cvd = "deutan")
```

```{python}
#| echo: true
#| warning: true
#| error: true
pal.swatchplot(n = 21, figsize = (8, 2),
               show_names = False,
               cvd = ["protan", "deutan", "tritan", "desaturate"])
```



