plotMap: Drawing a Thematic Map with a Quantitative Feature

View source: R/HCV.R

plotMapR Documentation

Drawing a Thematic Map with a Quantitative Feature

Description

Plot the polygons in a SpatialPolygonsDataFrame object, and turn the values of a quantitative feature into colors over individual polygons.

Usage

plotMap(
  map,
  feat,
  color = topo.colors(10),
  main = "",
  bar_title = "rank",
  zlim = NULL
)

Arguments

map

SpatialPolygonsDataFrame object consisting of data and polygons.

feat

numberic vector having the same elements as the number of polygons in the input map.

color

vector of distinct colors for converting values of feat.

main

character specifying the main title.

bar_title

character specifying the text over the color bar.

zlim

length-2 numeric vector specifying the range of values to be converted.

Value

A colored map.

See Also

SpatialPolygonsDataFrame

Examples

require(sp)
grd  <-  GridTopology(c(1,1),  c(1,1),  c(5,5))
polys  <-  as(grd,  "SpatialPolygons") 
centroids  <-  coordinates(polys)
gdomain  <-  SpatialPolygonsDataFrame(polys,  data=data.frame(x=centroids[,1],  
  y=centroids[,2], row.names=row.names(polys)))
feat <- gdomain$x*5+gdomain$y^2
plotMap(gdomain,feat)


HCV documentation built on March 18, 2022, 6:01 p.m.

Related to plotMap in HCV...