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

clickpoly

Interactively Define a Polygon


Description

Allows the user to create a polygon by point-and-click in the display.

Usage

clickpoly(add=FALSE, nv=NULL, np=1, ...)

Arguments

add

Logical value indicating whether to create a new plot (add=FALSE) or draw over the existing plot (add=TRUE).

nv

Number of vertices of the polygon (if this is predetermined).

np

Number of polygons to create.

...

Arguments passed to locator to control the interactive plot, and to polygon to plot the polygons.

Details

This function allows the user to create a polygonal window by interactively clicking on the screen display.

The user is prompted to point the mouse at any desired locations for the polygon vertices, and click the left mouse button to add each point. Interactive input stops after nv clicks (if nv was given) or when the middle mouse button is pressed.

The return value is a window (object of class "owin") representing the polygon.

This function uses the R command locator to input the mouse clicks. It only works on screen devices such as ‘X11’, ‘windows’ and ‘quartz’. Arguments that can be passed to locator through ... include pch (plotting character), cex (character expansion factor) and col (colour). See locator and par.

Multiple polygons can also be drawn, by specifying np > 1. The polygons must be disjoint. The result is a single window object consisting of all the polygons.

Value

A window (object of class "owin") representing the polygon.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz.

See Also


spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

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