addPolys | R Documentation |
Add a PolySet
to an existing plot, where each unique (PID
,
SID
) describes a polygon.
addPolys(polys, xlim = NULL, ylim = NULL, polyProps = NULL,
border = NULL, lty = NULL, col = NULL, colHoles = NULL,
density = NA, angle = NULL, ...)
.insertNAs(polys, idx)
.preparePolyProps(polysPID, polysSID, polyProps)
.rollupPolys(polys, rollupMode, exteriorCCW, closedPolys, addRetrace)
polys |
|
xlim |
|
ylim |
|
polyProps |
|
border |
|
lty |
|
col |
|
colHoles |
|
density |
|
angle |
|
... |
|
idx |
|
polysPID |
|
polysSID |
|
rollupMode |
|
exteriorCCW |
|
closedPolys |
|
addRetrace |
|
The plotting routine connects the last vertex of each discrete polygon
to the first vertex of that polygon. It supports both
borders (border
, lty
) and fills (col
,
density
, angle
). It clips polys
to xlim
and ylim
before plotting.
For additional help on the arguments border
, lty
,
col
, density
, and angle
, please see
polygon
and par
.
PolyData
consisting of the PolyProp
s used to create the plot.
Auxiliary dot function '.insertNAs'
facilitates (hastens)
the plotting of polygons and polylines. It also reduces the incidence
of retrace lines.
Auxiliary dot function '.preparePolyProps'
performs
at least one of the following tasks:
1) creates 'polyProps'
if it equals NULL
;
2) adds 'SID'
column to 'polyProps'
if one exists in 'polys'
;
3) removes from 'polyProps'
any PID
s that do not exist in 'polys'
.
Returns a polyProps
object.
Auxiliary dot function '.rollupPolys'
does not validate a PolySet
;
returns a rolled-up PolySet
or NULL
.
Nicholas M. Boers, Software Engineer, Jobber, Edmonton AB
Maintainer: Rowan Haigh, Program Head – Offshore Rockfish
Pacific Biological Station (PBS), Fisheries & Oceans Canada (DFO), Nanaimo BC
locus opus: Remote office, Vancouver BC
Last modified Rd: 2024-09-03
In package PBSmapping:
addLabels
,
addLines
(also uses '.preparePolyProps'
and '.insertNAs'
),
addPoints
,
addStipples
'.rollupPolys'
is also called by:
calcArea
,
calcCentroid
,
calcLength
,
calcSummary
,
fixPOS
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
plotPolys(polys,xlim=c(-.5,1.5),ylim=c(-.5,1.5),density=0,projection=1)
#--- add the PolySet to the plot (in a different style)
addPolys(polys,col="green",border="blue",lwd=3)
par(oldpar)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.