add_col {CCAMLRGIS} | R Documentation |
Add colors
Description
Given an input variable, generates either a continuous color gradient or color classes.
To be used in conjunction with add_Cscale
.
Usage
add_col(var, cuts = 100, cols = c("green", "yellow", "red"))
Arguments
var |
numeric vector of the variable to be colorized. Either all values (in which case all values will be assigned to a color) or only two values (in which case these are considered to be the range of values). |
cuts |
numeric, controls color classes. Either one value (in which case |
cols |
character vector of colors (see R standard color names here).
|
Value
list containing the colors for the variable var
(given as $varcol
in the output) as
well as the single cols
and cuts
, to be used as inputs in add_Cscale
.
See Also
add_Cscale
, create_PolyGrids
, add_Legend
,
R colors.
Examples
# For more examples, see:
# https://github.com/ccamlr/CCAMLRGIS#52-adding-colors-to-data
MyPoints=create_Points(PointData)
MyCols=add_col(MyPoints$Nfishes)
plot(st_geometry(MyPoints),pch=21,bg=MyCols$varcol,cex=2)