Friendly function to create a polygon corresponding with given values of the polygon's corners. The polygon is then colored automatically.
dsregion(..., col = "yellow", border = NA, behind = TRUE) dspolygon(x, y, col = "yellow", border = NA, behind = TRUE)
... | Takes points which will act as corners. See example and details for usage. |
---|---|
col | The color of the polygon |
border | The color of the border of the polygon. |
behind | Forces the polygon to be a background object for the purposes of layering. |
x | A numeric vector containing the x-values of each corner. |
y | A collection (for example: |
dspolygon
takes the x and y points similar to the default polygon
function.
The x
parameter takes a numeric vector containing the x-values of each corner.
The y
parameter takes a numeric vector containing the y-values of each corner.
The x
and y
coordinates of the corners of the polygon
will be the pairs made from the x
and y
parameters with equal indices.
The ...
parameter in dsregion
can take multiple
dspoint
s, pnt
s,
or simply vectors each containing two points c(x,y)
.
See the examples if clarification is needed.
dspoint
simattractors
simbasins
library(dsmodels) fun <- function(X,Y) { list( X/exp(Y), Y/exp(X) ) } model <- dsmodel(fun, title = "Regions!") range <- dsrange(3, 3, discretize = .09) model+range# dspolygon usage model + dspolygon(x = c(-.05,3,3), y = c(0,0,3), col = "yellow")