fillmaps | R Documentation |
This function offers several options for creating plots with SpatialPolygons objects. This can be a single plot or multiple plots. These multi-plots can have the same legend or individual legends. Additionally, the layout call within this function offers many options for improving the resulting figures.
fillmaps( map, figtitle, y, n.col, bk = "e", cuts, legendtxt = "", leg.loc = "bottomright", leg.common = F, lay.m = matrix(1), lay.wid = rep.int(1, ncol(lay.m)), leg.cex = 1.5, main.cex = 1.5, main.line = -2, lay.hei = rep.int(1, nrow(lay.m)), leg.horiz = F, map.lty = 1 )
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. |
n.col |
The number of legend levels. |
bk |
The break specifications defaults to "e" for equal. Other options are "c" to specify your own breaks and "q" for quantile breaks. |
cuts |
The cuts to be specified when bk="c". |
legendtxt |
The text to be displayed in the legend (must be NA (which removes the text altogether) or equal length n.col+1). Defaults to "" which creates text based on the cuts. |
leg.loc |
The loation for the legend defaults to "bottomright". Can also be given as a list of x,y coordinates |
leg.common |
Indicates if a common legend is to be used in the multiple plotting setting. Defaults to FALSE. |
lay.m |
The matrix to be supplied to the layout call. Defaults to matrix(1) for a single plot. |
lay.wid |
Specifies the widths for the layout call. Defaults to rep.int(1,ncol(lay.m)). |
leg.cex |
Specifies the font size in the legend. Defaults to 1.5. |
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. |
lay.hei |
Specifies the heights for the layout call. Defaults to rep.int(1,nrow(lay.m)). |
leg.horiz |
Indicates if the legend should be horizontal. Defaults to FALSE. |
map.lty |
Specifies the line type for the plot. Defaults to 1. |
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) vmat=matrix(runif(12*3,0,1),nrow=12,ncol=3) par(mai=c(0,0,0,0),mar=c(0.1,0,0,0)) fillmaps(SpP,c("","Example 1",""),vmat,n.col=3,bk="c", cuts=seq(min(vmat),max(vmat),length=4),main.cex=2,leg.cex=2, leg.loc="top",leg.common=T,lay.hei=c(.8,.2),leg.horiz=T, lay.m=matrix(c(1,2,3,4,4,4),ncol=3,nrow=2,byrow=T))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.