distinct_rgb_palette | R Documentation |
This function uses kmeans()
over the RGB colorspace to generate N distinct
RGB colors.
distinct_rgb_palette(n, alpha = 1, ...)
n |
numeric. Number of colors to generate |
alpha |
numeric. Transparency level of the color palette (0-1). Default 1.0 |
... |
arguments passed to |
This function uses very inaccurate defaults for the kmeans()
function in
the interest of speed. It's usually not a problem if kmeans()
does not
converge (colors are distinct enough for most purposes). If you get warnings,
or you don't like the colors produced, you can modify the default arguments to the
kmeans()
function by passing in additional arguments to ...
. For example,
increasing iterations can be done by passing iter.max = 100
. Changing the
kmeans algorithm can be done by specifying algorithm = "MacQueen"
. Changing
these arguments may eliminate warnings or produce more distinct colors.
vector of distinct RGB colors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.