freq.cols | R Documentation |
This function uses a given set of colors and frequencies of them within given dataset and range to derive a set of a given number of colors fitting with the inputted frequencies.
freq.cols(cols, ncols, freqs, lims, type, values)
cols |
The vector of colors to be resized given data and frequencies |
ncols |
The number of desired colors for the new vector of colors with adjusted color proportions |
freqs |
The inputted frequencies of the colors. Can be a character ( |
lims |
The limits to use to compute bounds (and then adjusted frequencies) for each color. Set by default to the range of |
type |
If specifying proportions to |
values |
If |
This function mainly relies on discrete.palette to resize the inputted colors taking into account their frequencies.
The frequencies freqs
can be given explicitly (if specifying numeric values), otherwise they are considered to be all equal (if specifying a character).
Numeric frequencies can be either proportions or bounds between lims
. In both cases, they depend on a given set of values
and on limits lims
to consider (by default the range of the dataset).
If frequencies are proportions, they are converted to bounds to determine the effective width between them (or to one of the limits) relative to the inter-limits width. Hence, bounds can also be directly provided, if known.
Such relative widths then serve as the freqs
argument of discrete.palette.
If proportions are provided (explicit numeric or just character), it is also possible to say with type
whether these proportions are between-limits width proportion or values
population proportion. In the latter case, quantiles corresponding to the given frequencies freqs
are hence used as bounds.
The output will use adjusted frequencies (given the inputted one and the width/proportion choice if applicable) to resize the inputed colors cols
as a new vector of colors of size ncols
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.