legend.pie: Legend for pie plots

Description Usage Arguments Author(s) Examples

Description

Draw a legend for a draw.pie plot.

Usage

1
2
legend.pie(x, y = NULL, z, labels, radius = 1, bty = "o", mab = 1.2, bg = NULL, 
	inset = 0, ...)

Arguments

x, y

the x and y co-ordinates to be used to position the legend. x can be a keyword (e.g. "topleft". See legend.

z

optional vector of non-negative numerical quantities. The values in z are displayed as the areas of pie slices in the legend.

labels

character vector (same length as z) with labels for the pies.

radius

the radius of the pie to be displayed.

bty

single character indicating the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n" (no box).

mab

the margin around the pie. i.e. how much space should there be between the pie and the legend box. relative to the size of the pie.

bg

background colour of the legend box.

inset

inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword.

...

any other arguments to be passed on to add.pie.

Author(s)

Hans Gerritsen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(landings)
data(coast)
xlim <- c(-12,-5)
ylim <- c(50,56)
xyz <- make.xyz(landings$Lon,landings$Lat,landings$LiveWeight,landings$Species)
col <- rainbow(5)
basemap(xlim, ylim, main = "Species composition of gadoid landings")
draw.shape(coast, col="cornsilk")
draw.pie(xyz$x, xyz$y, xyz$z, radius = 0.3, col=col)
legend.pie(-13.25,54.8,labels=c("cod","had","hke","pok","whg"), radius=0.3, bty="n", col=col,
 cex=0.8, label.dist=1.3)
legend.z <- round(max(rowSums(xyz$z,na.rm=TRUE))/10^6,0)
legend.bubble(-13.25,55.5,z=legend.z,round=1,maxradius=0.3,bty="n",txt.cex=0.6)
text(-13.25,56,"landings (kt)",cex=0.8)

Example output



mapplots documentation built on May 2, 2019, 9:15 a.m.