ellipse | R Documentation |
Calculates coordinates of points for plotting a 2-dimensional ellipse based on user-defined parameters. Can be used for exploratory data analysis to produce ellipses at a given niche region size (e.g., \alpha = 95\%
).
ellipse(mu, V, alpha = 0.95, n = 100)
mu |
Centre of ellipse. A vector of length 2. |
V |
Scale of ellipse. A 2x2 matrix. See 'Details'. |
alpha |
Niche region size. See 'Details'. |
n |
Number of points to return for plotting. |
This function provides the coordinates needed to plot a 2-dimensional ellipse based on user-defined parameters, such that X = c(x,y)
satisfies the equation
(X-\mu)' V^{-1} (X-\mu) = C,
where C=\code{qchisq(alpha, df = 2)}
.
Returns a matrix of coordinates cbind(x,y)
to plot a 2-dimensional ellipse.
niche.plot()
for plotting.
mu <- rnorm(2)
V <- crossprod(matrix(rnorm(4), 2, 2))
ell.pts <- ellipse(mu = mu, V = V, alpha = .9, n = 100)
plot(ell.pts, col = rainbow(110)[1:100], type = "o")
points(mu[1], mu[2], pch = "+")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.