library(raster)
data(africa)
Endm <- weighted_endemism(africa$comm)
m <- merge(africa$polys, data.frame(grids=names(Endm), WE=Endm), by="grids")
m <- m[!is.na(m@data$WE),]
plot_swatch(m, values = m$WE,
col = hcl.colors(20, palette = "Blue-Red 3", rev=FALSE))
Run the code above in your browser using DataLab