Plot Levels of a Variable in a Colour-Coded Map
ColorMap(values, map = NULL, polys = NULL, log = FALSE, nclr = 7, include.legend = list(TRUE), round = 3, brks = NULL, legend = NULL, location = "topright", rev = FALSE, alpha = 0.5, GRAY = FALSE, palette = c("YlOrRd", "RdYlGn", "Spectral")[1], textInPolys = NULL, ...)
values
: variable to plotmap
: map objectpolys
: an object of class SpatialPolygons (See SpatialPolygons-classlog
: boolean of whether to plot values on log scalenclr
: number of colour-levels to useinclude.legend
: boolean of whether to include legendround
: number of digits to round to in legendbrks
: if desired, pre-specified breaks for legendlegend
: if desired, a pre-specified legendlocation
: location of legendrev
: boolean of whether to reverse colour scheme (darker colours for smaller values)alpha
: alpha value of colorsGRAY
: boolean: if TRUE, use gray scale insteadpalette
: palette to choose from RColorBrewertextInPolys
: text to be displayed inside polygons. This can be a column names for values...
: extra args to pass to PlotPolysOnStaticMap
Markus Loecher
if (0){ data("NYleukemia", envir = environment()) population <- NYleukemia$data$population cases <- NYleukemia$data$cases mapNY <- GetMap(center=c(lat=42.67456,lon=-76.00365), destfile = "NYstate.png", maptype = "mobile", zoom=9) ColorMap(100*cases/population, mapNY, NYleukemia$spatial.polygon, add = FALSE, alpha = 0.35, log = TRUE, location = "topleft") } #ColorMap(100*cases/population, map=NULL, NYleukemia$spatial.polygon)
Downloads (last 30 days):