create2dData: Create 2D data set interactively.

create2dDataR Documentation

Create 2D data set interactively.

Description

create2dData allows you to interactively create a 2D data set by clicking points in 2D.

Usage

create2dData(xyRanges = c(0, 
    1, 0, 1), setupDevice = TRUE, 
    verb = 1, ...)

Arguments

xyRanges

ranges of 2D space (a numeric vector of length 4 giving the xmin, xma, ymin, and ymax limits)

setupDevice

logical flag specifying whether to setup the graphical device. Setting to FALSE enables to call ‘create2dData’ several times getting incrementally more and more points.

verb

verbosity level

...

optinal parameters passed to ‘points’

Details

The user places points in 2D by clicking in a graphical device, and gets coordinates of the clicked points.

For the usual ‘X11’ device the identification process is terminated by pressing any mouse button other than the first. For the ‘quartz’ device the process is terminated by pressing either the pop-up menu equivalent (usually second mouse button or ‘Ctrl’-click) or the ‘ESC’ key.

Value

a list of ‘x’ and ‘y’, each holding the coordinates of selected points

Author(s)

Tomas Sieger

See Also

identify

Examples

if (interactive()) {
  # create first sample
  xy<-create2dData()
  print(xy)

  # create another sample
  xy2<-create2dData(setupDevice=FALSE,col='red',pch=19)
  print(xy2)
}

tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.