addBubbles {PBSmapping}R Documentation

Add Bubbles to Maps

Description

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.

Usage

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, ...)

Arguments

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 "perceptual" emphasises large z-values while "volume" emphasises small z-values. Type "surface" lies in between.

z.max

maximum value for z (default = max(z)); determines the largest bubble; keeps the same legend for different maps.

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 FALSE, legend values are obtained using pretty() and consequently the largest bubble will be larger than max(z). If TRUE, the largest bubble in the legend will correspond to max(z).

legend.type

display format for legend.

legend.title

title for legend.

legend.cex

size of legend text.

...

additional arguments for points function that plots zero-value symbols.

Details

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.

Note

This function has not yet been fully transformed to work with EventData.

Author(s)

Denis Chabot, Institut Maurice-Lamontagne, Mont-Joli QC

References

Tanimura, S., Kuroiwa, C., and Mizota, T. (2006) Proportional symbol mapping in R. Journal of Statistical Software 15(5).

See Also

addPolys, surveyData

Examples

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")

[Package PBSmapping version 2.61.9 Index]