Description Usage Arguments Value Note Author(s) References Examples
Add point symbols to a plot. Proportional circle symbols may be used to represent point data, where symbol area varies in proportion to an attribute variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | AddPoints(
x,
y = NULL,
z = NULL,
zcol = 1,
crs = NULL,
xlim = NULL,
ylim = NULL,
zlim = NULL,
inches = c(0, 0.2),
scaling = c("perceptual", "mathematical", "radius"),
bg = "#1F1F1FCB",
bg.neg = NULL,
fg = NA,
lwd = 0.7,
cex = 0.7,
format = NULL,
legend.loc = "topright",
inset = 0.02,
bty = c("o", "n"),
breaks = NULL,
break.labels = NULL,
quantile.breaks = FALSE,
make.intervals = FALSE,
title = NULL,
subtitle = NULL,
draw.legend = TRUE,
draw.points = FALSE,
add = TRUE,
...
)
|
x, y |
'numeric' vector or 'SpatialPoints*'.
x and y coordinates for the centers of the circle symbols.
If numeric, can be specified in any way which is accepted by |
z |
'numeric' vector, 'integer' vector, or 'factor'.
Attribute variable.
For objects of class factor, a fixed radius is used for circle symbols,
see |
zcol |
'integer' count or 'character' string.
Attribute name or column number to extract from if |
crs |
'character' string or 'CRS'. Coordinate reference system arguments |
xlim |
'numeric' vector of length 2. x limits for the plot. |
ylim |
'numeric' vector of length 2. y limits for the plot. |
zlim |
'numeric' vector of length 2. z limits for the plot. |
inches |
'numeric' vector of length 2.
Radii limits for the drawn circle symbol.
Alternatively, a single number can be given resulting in
a fixed radius being used for all circle symbols;
this overrides proportional circles and the function
behaves like the |
scaling |
'character' string.
Selects the scaling algorithm to use for symbol mapping.
Specify |
bg |
'character' vector or 'function'. Fill color(s) for circle symbols. A color palette also may be specified. |
bg.neg |
'character' vector or 'function'.
Fill color(s) for circle symbols corresponding to negative |
fg |
'character' string.
Outer-line color for circle symbols.
Specify a value of |
lwd |
'numeric' number. Line width for drawing circle symbols. |
cex |
'numeric' number. Character expansion factor for legend labels. |
format |
'character' string.
Formatting for legend values, see |
legend.loc |
'character' string.
Position of the legend in the main plot region;
see |
inset |
'numeric' number. Inset distance of the legend from the margins as a fraction of the main plot region. Defaults to 2 percent of the axis range. |
bty |
'character' string.
Type of box to be drawn about the legend.
A value of |
breaks |
'numeric' vector. Finite breakpoints for the legend circle symbols. |
break.labels |
'character' vector.
Break labels with length equal to |
quantile.breaks |
'logical' flag.
If true, |
make.intervals |
'logical' flag.
If true, represent |
title |
'character' string. Main title to be placed at the top of the legend. |
subtitle |
'character' string. Legend subtitle to be placed below the main title. |
draw.legend |
'logical' flag. If true, a legend is drawn. |
draw.points |
'logical' flag. If true, the circle symbols are drawn. |
add |
'logical' flag. If true, circle symbols (and an optional legend) are added to an existing plot. |
... |
Graphics parameters to be passed to |
Invisible NULL
To avoid overplotting, circle symbols are drawn in order of decreasing radius.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
Tanimura, S., Kuroiwa, C., and Mizota, T., 2006, Proportional Symbol Mapping in R: Journal of Statistical Software, v. 15, no. 5, 7 p.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | set.seed(2)
n <- 50L
x <- cbind(runif(n, 1, 10), runif(n, 1, 500))
z <- runif(n, 0, 1000)
z[sample.int(n, 2)] <- 0
AddPoints(x, z = z, fg = "#00000080", lwd = 0.5, title = "Title",
subtitle = "Subtitle", add = FALSE)
idxs <- sample.int(n, floor(n / 2))
z[idxs] <- -z[idxs]
AddPoints(x, z = z, bg.neg = "#2A8FBDCB",
breaks = pretty(z, n = 8),
legend.loc = "bottomleft", add = FALSE)
Pal1 <- colorRampPalette(c("#CA0020CB", "#F4A582CB"), alpha = TRUE)
Pal2 <- colorRampPalette(c("#0571B0CB", "#92C5DECB"), alpha = TRUE)
AddPoints(x, z = z, bg = Pal1, bg.neg = Pal2, add = FALSE)
AddPoints(x, z = z, bg = Pal1, bg.neg = Pal2, add = FALSE,
make.intervals = TRUE)
AddPoints(x, z = z, bg = Pal1, bg.neg = Pal2, add = FALSE,
make.intervals = TRUE, inches = 0.1)
AddPoints(x, z = abs(z), title = "Quantiles", bg = topo.colors,
quantile.breaks = TRUE, add = FALSE)
z <- as.factor(rep(c("dog", "cat", "ant", "pig", "bat"),
length.out = n))
bg <- GetColors(nlevels(z), scheme = "bright", alpha = 0.8)
AddPoints(x, z = z, bg = bg, add = FALSE)
AddPoints(x, draw.legend = FALSE, add = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.