Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addLines

Add a PolySet to an Existing Plot as Polylines


Description

Add a PolySet to an existing plot, where each unique (PID, SID) describes a polyline.

Usage

addLines (polys, xlim = NULL, ylim = NULL,
    polyProps = NULL, lty = NULL, col = NULL, arrows = FALSE, ...)

Arguments

polys

PolySet to add (required).

xlim

range of X-coordinates.

ylim

range of Y-coordinates.

polyProps

PolyData specifying which polylines to plot and their properties. par parameters passed as direct arguments supersede these data.

lty

vector of line types (cycled by PID).

col

vector of colours (cycled by PID).

arrows

Boolean value; if TRUE, add arrows using the arrows function and consider the arguments angle, length, and code.

...

additional par parameters for the lines function.

Details

The plotting routine does not connect the last vertex of each discrete polyline to the first vertex of that polyline. It clips polys to xlim and ylim before plotting.

For additional help on the arguments lty and col, please see par.

Value

PolyData consisting of the PolyProps used to create the plot.

Author(s)

Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10

See Also

Examples

local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  #--- create a PolySet to plot
  polys <- data.frame(PID=rep(1,4),POS=1:4,X=c(0,1,1,0),Y=c(0,0,1,1))
  polys <- as.PolySet(polys, projection=1)
  #--- plot the PolySet
  plotLines(polys, xlim=c(-.5,1.5), ylim=c(-.5,1.5), projection=1)
  #--- add the PolySet to the plot (in a different style)
  addLines(polys, lwd=5, col=3)
  par(oldpar)
})

PBSmapping

Mapping Fisheries Data and Spatial Analysis Tools

v2.73.0
GPL (>= 2)
Authors
Jon T. Schnute [aut], Nicholas Boers [aut], Rowan Haigh [aut, cre], Alex Couture-Beil [ctb], Denis Chabot [ctb], Chris Grandin [ctb], Angus Johnson [ctb], Paul Wessel [ctb], Franklin Antonio [ctb], Nicholas J. Lewin-Koh [ctb], Roger Bivand [ctb]
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.