Description Usage Arguments Calling dspolygon Correctly Calling dsregion Correctly See Also Examples
Friendly function to create a polygon corresponding with given values of the polygon's corners. The polygon is then colored automatically.
1 2 3 |
... |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.