draw.xy: Draw xy sub-plots in an existing plot

Description Usage Arguments Details Author(s) Examples

Description

This function is intended to draw xy-plots or barplots in existing maps or other plots.

Usage

1
2
draw.xy(x, y, xx, yy, xlim = NULL, ylim = NULL, width = 1, height = 0.5, bg = NULL, 
	border = 1, type = "p", col = 1, silent = TRUE, ...)

Arguments

x, y

vectors with x and y-locations of the centre of the xy-plots.

xx, yy

vectors (of the same length as x) with the x and y-values of the xy-plots

xlim, ylim

the x and y-limits of the xy-plots. the same limits will apply to all xyplots. Defaults to range(xx) and range(yy).

width, height

the width and height of the xy-plot area (coordinate units of the main map or plot).

bg

background colour of the xy-plots

border

the colour of the border of the xy-plots. NA will result in no border

type

the type of plot. See plot.default for possible values. Also see Details section below

col

a single colour or a vector of colours (same length as x) for the plotting symbols.

silent

logical, should a progress message be displayed in the console? Defaults to FALSE.

...

other arguments to be passed to points

Details

type = "h" will result in plots that resemble barplots. These are not true barplots as the x-axis is not categorical. However if suitable xx data are provided and lwd is tweaked correctly for the current graphical device it will result in adequate plots.

Author(s)

Hans Gerritsen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(effort)
data(coast)
xlim <- c(-12,-5)
ylim <- c(51,54)
col <- terrain.colors(12)
effort$col <- col[match(effort$Month,1:12)]
basemap(xlim, ylim, main = "Monthly trends in haddock landings and fishing effort")
draw.rect(lty=1, col=1)
draw.shape(coast, col="cornsilk")
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$LiveWeight, width=1, height=0.5,
 col=effort$col, type="h",lwd=3, border=NA)
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$Effort, width=1, height=0.5, col="red",
 type="l", border=NA)
draw.xy(effort$Lon, effort$Lat, effort$Month, effort$Effort, width=1, height=0.5, col="red",
 type="p",cex=0.4,pch=16, border=NA)
legend("topleft", c(month.abb,"Effort"), pch=c(rep(22,12),16), pt.bg=c(col,NA),
 pt.cex=c(rep(2,12),0.8),col=c(rep(1,12),2), lty=c(rep(NA,12),1), bg="lightblue",
 inset=0.02, title="Landings", cex=0.8)

Example output



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