ColorMap {RgoogleMaps}R Documentation

Plot Levels of a Variable in a Colour-Coded Map

Description

Plot Levels of a Variable in a Colour-Coded Map

Usage

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, 
    ...)

Arguments

values

variable to plot

map

map object

polys

an object of class SpatialPolygons (See SpatialPolygons-class

log

boolean of whether to plot values on log scale

nclr

number of colour-levels to use

include.legend

boolean of whether to include legend

round

number of digits to round to in legend

brks

if desired, pre-specified breaks for legend

legend

if desired, a pre-specified legend

location

location of legend

rev

boolean of whether to reverse colour scheme (darker colours for smaller values)

alpha

alpha value of colors

GRAY

boolean: if TRUE, use gray scale instead

palette

palette to choose from RColorBrewer

textInPolys

text to be displayed inside polygons. This can be a column names for values

...

extra args to pass to PlotPolysOnStaticMap

Author(s)

Markus Loecher

Examples

  if (interactive()){
  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)
  

[Package RgoogleMaps version 1.4.2 Index]