This function links data and a colour palette. Numerical bounds are added to the 3 x 3 colour grid.
build_bkey(
data,
palette = "BlueYellow",
terciles = FALSE,
flipAxis = FALSE,
expertR_est = NA,
expertR_err = NA,
bound = NULL,
fontSize = 3,
transparent = FALSE
)
A data frame.
Name of colour palette or character vector of hex colour codes
created with build_palette
function. Colour palette names
include BlueYellow
, CyanMagenta
, BlueRed
and
GreenBlue
.
A logical value. This provides the option to define numerical bounds for the colour key grid using terciles instead of equal intervals.
A logical value. Whether to place the axis on the opposite sides or not.
A vector consisting of the range of expert values for the estimate (Default: NA).
A vector consisting of the range of expert values for the error (Default: NA).
A vector of eight elements representing the bounds for the
estimate and error that will be used on the bivariate colour key. These can
be created offline using the findNbounds
function.
An integer value. Default is 3.
A logical value. Option to make the key background transparent. Default value is FALSE.
A key for the bivariate map is not automatically generated with
build_bmap
and must be made using build_bkey
. It
is important that the arguments passed to build_bkey
match those
passed to build_bmap
. The map and key can be viewed together
using attach_key
.
If bound is NULL, the bounds for the legend will be computed from the data and expert bounds (if available) using the findNbound function. The argument bound should only be used if you want to make comparison against multiple maps. For that scenario, the user should use the findNbounds function to generate a bound for the larger set of data that wish to compare.
data(us_data)
data(us_geo)
poverty <- read.uv(data = us_data, estimate = "pov_rate", error = "pov_moe")
# use a prepared palette and terciles
key <- build_bkey(data = poverty, terciles = TRUE)
view(key)
# use a created palette
p <- build_palette(name = "usr", colrange =
list(colour = c("darkblue", "chartreuse4"), difC = c(3, 4)))
key <- build_bkey(data = poverty, palette = p)
view(key)