make_color_pal | R Documentation |
Control the mapping of values to colors with colors
,
color_mode
, and zlim
.
make_color_pal(
colors = NULL,
color_mode = c("sequential", "qualitative", "diverging"),
zlim = NULL
)
colors |
(Optional) "ROY_BIG_BL", the name of a ColorBrewer palette
(see |
color_mode |
(Optional) |
zlim |
(Optional) Controls the mapping of values to each color in
|
There are three kinds of arguments for colors
: "ROY_BIG_BL"
,
the name of a ColorBrewer palette (see RColorBrewer::brewer.pal.info
and colorbrewer2.org), the name of a viridisLite palette, or a character
vector of color names.
If colors=="ROY_BIG_BL"
, the "ROY_BIG_BL" palette will be used. It is
the same palette as the default for the Connectome Workbench application
(https://github.com/Washington-University/workbench/blob/master/src/Files/PaletteFile.cxx).
The midpoint will be colored
black. From the midpoint toward the upper bound, colors will proceed from
black to red to yellow. From the midpoint toward the lower bound, colors
will proceed from black to blue to purple to green to aqua. Here is how each
color mode behaves if colors=="ROY_BIG_BL"
:
color_mode=="sequential"
Only half of the palette will be
used. If zlim
is length 2, the higher value will be the maximum and
the lower value will be the minimum. Set zlim[1] > zlim[2]
to
reverse the color scale. (Note that the second half, black –> red –>
yellow, is used by default. To use the negative half specify
colors=="ROY_BIG_BL_neg"
instead. It will also be used automatically
by xifti_read_surface
when the data range is negative.)
zlim
can also be length 10, in which case each value corresponds to
the position of an individual color in the half palette.
color_mode=="qualitative"
"ROY_BIG_BL" is not recommended for
qualitative data, so a warning will be issued. Palette colors will be
selected from the landmark "ROY_BIG_BL" colors, with interpolated colors
added if the number of colors in the palette (18) is less than this range.
zlim
should be a single number: the number of unique colors to get.
color_mode=="diverging"
If zlim
is length 2 or 3, the
lowest number will be the lower bound and the highest number will
be the upper bound. If zlim
is length 3, the middle number will be the
midpoint (black). The lower and upper bounds will be aqua and yellow,
respectively, except if zlim
is in descending order, in which case
the color scale will be reversed (lowest is yellow; highest is aqua).
zlim
can also be length 19, in which case each value corresponds to
the position of an individual color in the palette.
If colors
is the name of an RColorBrewer palette (see
RColorBrewer::brewer.pal.info
) or viridisLite palette, the colors in
that palette will be used, and the following behavior applies.
If colors
is a character vector of color names (hex codes or standard
R color names), the following behavior applies directly:
color_mode=="sequential"
If zlim
is length 2, the
higher value will be the maximum and the lower value will be the minimum.
Set zlim[1] > zlim[2]
to reverse the color scale. zlim
can
also be the same length as the palette, in which case each value
corresponds to the position of an individual color in the palette.
color_mode=="qualitative"
zlim
should be a single
number: the number of unique colors to get. Color interpolation will be
used if the number of colors in the palette is less than this range. If
length(zlim)==length(colors)
, each color will be mapped to each
corresponding value.
color_mode=="diverging"
If zlim
is length 2 or 3, the
lowest number will be the lower bound and the highest number will
be the upper bound. If zlim
is length 3, the middle number will be the
midpoint. Set zlim
in descending order to reverse the color scale.
zlim
can also be the same length as the palette, in which case each
value corresponds to the position of an individual color in the palette.
A data.frame with two columns: "color"
(character: color hex
codes) and "value"
(numeric)
Other coloring:
ROY_BIG_BL()
,
expand_color_pal()
,
use_color_pal()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.