addBubbles {PBSmapping} | R Documentation |
Add bubbles proportional to some value (e.g., catch, effort) to a map. The function takes x, y and z arguments and optional arguments to draw bubbles of radius proportional to the z variable.
addBubbles(x, y, z, type=c("perceptual","surface","volume"), z.max=max(z,na.rm=TRUE), max.size=0.05, symbol.zero="+", symbol.fg=rgb(0,0,0,0.6), symbol.bg=rgb(0,0,0,0.3), legend.pos="bottomleft", legend.breaks=pretty(range(z),3)[-1], show.actual=FALSE, legend.type=c("nested","horiz","vert"), legend.title="Abundance", legend.cex=0.8, ...)
x |
X-coordinates compatible with map already plotted. |
y |
Y-coordinates compatible with map already plotted. |
z |
values that will determine relative size of bubbles at (X,Y). |
type |
scaling option for bubbles where |
z.max |
maximum value for z (default = |
max.size |
maximum size (inches) of the largest bubble. |
symbol.zero |
symbol to reprezent zero-value z-values. |
symbol.fg |
bubble outline (border) colour. |
symbol.bg |
bubble interior (fill) colour. |
legend.pos |
position for the legend. |
legend.breaks |
break values for categorizing the z-values. The automatic method should work if zeroes are present; otherwise you can specify your own break values for the legend. |
show.actual |
logical: if |
legend.type |
display format for legend. |
legend.title |
title for legend. |
legend.cex |
size of legend text. |
... |
additional arguments for |
Modified (and for the legend, strongly inspired) from Tanimura et al. (2006) by Denis Chabot to work with PBSmapping.
Furthermore, Chabot's modifications make it possible to draw
several maps with bubbles that all have the same scale
(instead of each bubble plot having a scale that depends on
the maximum z-value for that plot). This is done by making
z.max
equals to the largest z-value from all maps that will be plotted.
The user can also add a legend in one of four corners
(see legend::legend
) or at a specific x-y position.
If legend.pos
is NULL
, no legend is drawn.
This function has not yet been fully transformed to work with EventData.
Denis Chabot, Institut Maurice-Lamontagne, Mont-Joli QC
Tanimura, S., Kuroiwa, C., and Mizota, T. (2006) Proportional symbol mapping in R. Journal of Statistical Software 15(5).
require(PBSmapping) data(nepacLL,surveyData) plotMap(nepacLL, xlim=c(-131.8,-127.2), ylim=c(50.5,52.7), col="gainsboro",plt=c(.08,.99,.08,.99)) addBubbles(surveyData$X, surveyData$Y, surveyData$catch, symbol.bg=rgb(.9,.5,0,.6), legend.type="nested", symbol.zero="+", col="grey")