draw.bubble: Draw bubble plots in an existing plot

View source: R/draw.bubble.R

draw.bubbleR Documentation

Draw bubble plots in an existing plot

Description

Bubble plots are plots of circles whose surfaces areas are proportional to values in z.

Usage

draw.bubble(x, y, z, maxradius = 1, ...)

Arguments

x,y

vector with x and y-locations of the centre of the bubbles.

z

vector with positive values to correspond with the surface area of the bubbles.

maxradius

the radius of the largest bubble in units of the y-scale.

...

other arguments to be passed to points

Author(s)

Hans Gerritsen

Examples

data(landings)
data(coast)
xlim <- c(-12,-5)
ylim <- c(50,56)
agg <- aggregate(list(z=landings$LiveWeight),list(x=landings$Lon,y=landings$Lat),sum)
basemap(xlim, ylim, main = "Gadoid landings")
draw.shape(coast, col="cornsilk")
draw.bubble(agg$x, agg$y, agg$z, maxradius=0.5, pch=21, bg="#00FF0050")
legend.z <- round(max(agg$z)/1000,0)
legend.bubble("topright", z=legend.z, maxradius=0.5, inset=0.02, bg="lightblue", txt.cex=0.8,
 pch=21, pt.bg="#00FF0050")

mapplots documentation built on Aug. 25, 2023, 5:15 p.m.