Last data update: 2014.03.03

R: Add EventData/PolyData to an Existing Plot as Points
addPointsR Documentation

Add EventData/PolyData to an Existing Plot as Points

Description

Add EventData/PolyData to an existing plot, where each unique EID describes a point.

Usage

addPoints (data, xlim = NULL, ylim = NULL, polyProps = NULL,
           cex = NULL, col = NULL, pch = NULL, ...)

Arguments

data

EventData or PolyData to add (required).

xlim

range of X-coordinates.

ylim

range of Y-coordinates.

polyProps

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

cex

vector describing character expansion factors (cycled by EID or PID).

col

vector describing colours (cycled by EID or PID).

pch

vector describing plotting characters (cycled by EID or PID).

...

additional par parameters for the points function.

Details

This function clips data to xlim and ylim before plotting. It only adds PolyData containing X and Y columns.

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

Value

PolyData consisting of the PolyProps used to create the plot.

See Also

combineEvents, convDP, findPolys, locateEvents, plotPoints.

Examples

local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  #--- load the data (if using R)
  if (!is.null(version$language) && (version$language=="R"))
    data(nepacLL,surveyData,envir=.PBSmapEnv)
  #--- plot a map
  plotMap(nepacLL, xlim=c(-136, -125), ylim=c(48, 57))
  #--- add events
  addPoints(surveyData, col=1:7)
  par(oldpar)
})

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PBSmapping)

-----------------------------------------------------------
PBS Mapping 2.69.76 -- Copyright (C) 2003-2016 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/home/ddbj/local/lib64/R/library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2015-04-23
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
http://code.google.com/p/pbs-software/

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------


> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PBSmapping/addPoints.Rd_%03d_medium.png", width=480, height=480)
> ### Name: addPoints
> ### Title: Add EventData/PolyData to an Existing Plot as Points
> ### Aliases: addPoints
> ### Keywords: aplot
> 
> ### ** Examples
> 
> local(envir=.PBSmapEnv,expr={
+   oldpar = par(no.readonly=TRUE)
+   #--- load the data (if using R)
+   if (!is.null(version$language) && (version$language=="R"))
+     data(nepacLL,surveyData,envir=.PBSmapEnv)
+   #--- plot a map
+   plotMap(nepacLL, xlim=c(-136, -125), ylim=c(48, 57))
+   #--- add events
+   addPoints(surveyData, col=1:7)
+   par(oldpar)
+ })
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>