fillmap2: Create maps with SpatialPolygons objects

View source: R/fillmap.R

fillmap2R Documentation

Create maps with SpatialPolygons objects

Description

This function offers several options for creating plots with SpatialPolygons objects. This is for producing a single plot with a continuous coloring. The viridis package is required.

Usage

fillmap2(
  map,
  figtitle,
  y,
  leg.loc = "beside",
  y.scl = NULL,
  main.cex = 1.5,
  main.line = 0,
  map.lty = 1,
  leg.rnd = 0,
  leg.cex = 1
)

Arguments

map

The SpatialPolygon object.

figtitle

The title to be displayed on the map(s). Can be of length 1 or more.

y

The vector or matrix object to be mapped.

leg.loc

The loation for the legend defaults to "beside". The other option is "beside".

y.scl

A vector for scaling the legend. Does not need to be the same length as y.

main.cex

Specifies the font size for the title. Defaults to 1.5.

main.line

Specifies the line for the title of the plot to appear on. Defaults to -2.

map.lty

Specifies the line type for the plot. Defaults to 1.

leg.rnd

Specifies the decimals for rounding the legend. Defaults to 0.

leg.cex

Specifies the font size in the legend. Defaults to 1.5.

Examples

Sr1 = Polygon(cbind(c(0,0,1,1,0),c(0,1,1,0,0)))
Sr2 = Polygon(cbind(c(0,1,1,0,0),c(0,0,-1,-1,0)))
Sr3 = Polygon(cbind(c(0,-1,-1,0,0),c(0,0,1,1,0)))
Sr4 = Polygon(cbind(c(0,0,-1,-1,0),c(0,-1,-1,0,0)))
Sr5 = Polygon(cbind(c(1,1,2,2,1),c(0,1,1,0,0)))
Sr6 = Polygon(cbind(c(0,2,2,1,1),c(0,0,-1,-1,0)))
Sr7 = Polygon(cbind(c(-1,-1,0,0,-1),c(1,2,2,1,1)))
Sr8 = Polygon(cbind(c(-1,-2,-2,-1,-1),c(1,1,2,2,1)))
Sr9 = Polygon(cbind(c(0,0,1,1,0),c(1,2,2,1,1)))
Sr10 = Polygon(cbind(c(-2,-2,-1,-1,-2),c(-2,-1,-1,-2,-2)))
Sr11 = Polygon(cbind(c(-2,-3,-3,-2,-2),c(-2,-2,-1,-1,-2)))
Sr12 = Polygon(cbind(c(-1,-1,0,0,-1),c(-2,-1,-1,-2,-2)))
Srs1 = Polygons(list(Sr1), "s1")
Srs2 = Polygons(list(Sr2), "s2")
Srs3 = Polygons(list(Sr3), "s3")
Srs4 = Polygons(list(Sr4), "s4")
Srs5 = Polygons(list(Sr5), "s5")
Srs6 = Polygons(list(Sr6), "s6")
Srs7 = Polygons(list(Sr7), "s7")
Srs8 = Polygons(list(Sr8), "s8")
Srs9 = Polygons(list(Sr9), "s9")
Srs10 = Polygons(list(Sr10), "s10")
Srs11 = Polygons(list(Sr11), "s11")
Srs12 = Polygons(list(Sr12), "s12")
SpP = SpatialPolygons(list(Srs1,Srs2,Srs3,Srs4,Srs5,Srs6,Srs7,Srs8,Srs9,
	Srs10,Srs11,Srs12), 1:12)

v=as.matrix(runif(12,0,1))
fillmap2(SpP,"Example 1",v)


carrollrm/fillmap documentation built on June 26, 2022, 3:06 a.m.