colormap {MapGAM} | R Documentation |
Maps Predicted Values and Clusters on a Two-Dimentional Map
Description
Displays a color image map, including a legend, scale bar, and optional North arrow, showing values for a grid of points. Irregular grids are allowed. Also draws contour lines for regions of signficantly increased or decreased predicted values ("clusters").
Usage
colormap(obj, map=NULL, exp=FALSE, add=FALSE, mapmin=NULL, mapmax=NULL,
col.seq=rev(rainbow(201,start=0,end=0.66)), anchor=FALSE,
border.gray = 0.3, contours="none",
contours.drawlabels=FALSE, contours.lty=1,
contours.lwd=1, contours.levels, contours.labcex=0.7,
interval.exclude=0, arrow=TRUE, axes=FALSE, ptsize=0.9, mai,
legend.name = "predicted values",legend.cex=1,
legend.add.line,alpha,...)
Arguments
obj |
(Required) A list containing at least these two elements: "grid" (a 2 column data frame with X and Y coordinates) and "fit" (the value to displayed on the map). |
map |
Can be used to map |
exp |
If |
add |
Use |
mapmin |
The minimum value for the color scale legend. When not specified, it will be set to the minimum predicted value. |
mapmax |
The maximum value for the color scale legend. When not specified, it will be set to the maximum predicted value. |
col.seq |
The color sequence (palette) used to display the predicted values on the map. The default is a rainbow palette, but divergent or sequential palettes may be better for some applications. See the colorspace library and the example below for other options. |
anchor |
Use |
border.gray |
Gray scale for the border of |
contours |
When |
contours.drawlabels |
Use |
contours.lty |
The line type for contour lines |
contours.lwd |
The width for contour lines. |
contours.levels |
The levels for contour lines. When |
contours.labcex |
cex for contour labelling. This is an absolute size, not a multiple of |
interval.exclude |
If |
arrow |
Use arrow=T to add a North arrow to the map. |
axes |
Use axes=T to add axes to the map (useful for chemical mixture isoboles). |
ptsize |
The size of the points used to fill in colors on the map. Increase to remove white space inside the map or decrease to remove color outside the map boundaries. NOTE: white space can also be eliminated by increasing the grid size in |
mai |
The margins of the plot. Details see par, |
legend.name |
The name of displayed for the legend bar. |
legend.cex |
A numerical value giving the amount by which legend text should be magnified relative to the default. |
legend.add.line |
A numerical value at which a line will be added on the legend bar to indicate the color for the value. |
alpha |
Levels |
... |
Other auguments past to plot function |
Value
Produces an image map. If the base map is in readOGR
format a scale bar is included, showing whatever measurement units are recorded in the shapefile. If the
units are missing from the shapefile conversion they are assumed to be meters.
Author(s)
Scott Bartell, Lu Bai, Robin Bliss, and Veronica Vieira
Send bug reports to sbartell@uci.edu.
See Also
trimdata
,
predgrid
,
plot.modgam
.
Examples
data(MAdata)
data(MAmap)
obj <- list(grid=data.frame(MAdata$Xcoord,MAdata$Ycoord),fit=MAdata$Mercury)
colormap(obj, MAmap, legend.name = "mercury")
# map the same data using a divergent color palette anchored to the median
if (require(colorspace)) {
newpal <- diverge_hsv(201) # from the colorspace library
colormap(obj, MAmap, legend.name = "mercury", col.seq = newpal,
legend.add.line=round(median(obj$fit),2), anchor = TRUE)
}