Learn R Programming

phyloregion (version 1.0.2)

choropleth: Bin values

Description

choropleth discretizes the values of a quantity for mapping.

Usage

choropleth(x, k = 10, style = "quantile", ...)

Arguments

x

Vector of values to discretize.

k

Numeric, the desired number of bins to discretize.

style

one of “equal”, “pretty”, or “quantile”.

Further arguments passed to or from other methods.

Value

a vector with the discretized values.

See Also

coldspots

Examples

Run this code
# NOT RUN {
library(sp)
s <- readRDS(system.file("nigeria/SR_Naija.rds", package = "phyloregion"))
k <- 10
COLOUR <- hcl.colors(k, "RdYlBu")
y <- choropleth(s$SR, k)

plot(s$SR, y)
## To plot and color according to some metric:
plot(s, col = COLOUR[y])
# }

Run the code above in your browser using DataLab