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
dspoints, pnts,
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")a <- dspoint(3,3) b <- dspoint(2.5,3) c <- dspoint(2,2) # Different inputs for dsregion shown below model + dsregion(a, b, c, col = "orange") + dsregion(pnt(0,0),pnt(1,0),pnt(1,1),pnt(0,1), col = "green") + dsregion(c(1,1),c(2,1),c(2,2),c(1,2), c(1.8,1.5), col = "magenta")