legend.grid: Legend for

View source: R/legend.grid.R

legend.gridR Documentation

Legend for

Description

Draw a legend for a draw.grid plot

Usage

legend.grid(x, y = NULL, breaks, col ,digits = 2, suffix = "", type = 1, pch = 15,
	pt.cex = 2.5, bg = "lightblue", ...)

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.

breaks

a vector of breakpoints for the colours, must give one more breakpoint than colour.

col

a vector with colours. defaults to colors ranging from white (lowest) through yellow and orange to red (highest).

digits

integer indicating the number of significant places to be used in the legend. Defaults to 2.

suffix

character string to be placed after the legend entries, e.g. "kg".

type

integer specifying the legend type, 1 will result in a single value for each colour (the average value for each colour category). Type 2 will result in a range being displayed for each colour category. This is more accurate but can make the legend take up a lot of space.

pch

plotting character, i.e., symbol to use. This can either be a single character or an integer code for one of a set of graphics symbols. See points. Defaults to 15.

pt.cex

character expansion of the symbols. Defaults to 2.5

bg

background colour for the legend box

...

other arguments to be passed to legend.

Author(s)

Hans Gerritsen

See Also

draw.grid

Examples

data(coast)
data(landings)
byx = 1
byy = 0.5
xlim <- c(-15.5,0)
ylim <- c(50.25,56)
grd <- make.grid(landings$Lon,landings$Lat,landings$LiveWeight, byx, byy, xlim, ylim)
breaks <- breaks.grid(grd,zero=FALSE)
basemap(xlim, ylim, main = "Gadoid landings")
draw.grid(grd,breaks)
draw.shape(coast, col="darkgreen")
legend.grid("topright", breaks=breaks/1000, type=2, inset=0.02, title="tonnes")

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