Learn R Programming

mixtools (version 2.0.0)

plotly_ellipse: Draw Two-Dimensional Ellipse Based on Mean and Covariance using plotly

Description

This is an updated version of ellipse. For more technical details, please refer to ellipse.

Usage

plotly_ellipse(mu, sigma, alpha=.05, npoints=250,
               draw=TRUE, cex = 3, col = "#1f77b4", lwd = 3,
               title = "", title.x = 0.5, title.y = 0.95, title.size = 15,
               xlab = "X", xlab.size = 15, xtick.size = 15,
               ylab = "Y", ylab.size = 15, ytick.size = 15)

Value

plotly_ellipse returns an npointsx2 matrix of the points forming the border of the ellipse.

Arguments

mu

A 2-vector giving the mean.

sigma

A 2x2 matrix giving the covariance matrix.

alpha

Probability to be excluded from the ellipse. The default value is alpha = .05, which results in a 95% ellipse.

npoints

Number of points comprising the border of the ellipse.

draw

If TRUE, draw the ellipse.

cex

Size of markers.

lwd

Line width of the ellipse.

col

Color of both markers and lines.

title

Text of the main title.

title.size

Size of the main title.

title.x

Horsizontal position of the main title.

title.y

Vertical posotion of the main title.

xlab

Label of X-axis.

xlab.size

Size of the lable of X-axis.

xtick.size

Size of tick lables of X-axis.

ylab

Label of Y-axis.

ylab.size

Size of the lable of Y-axis.

ytick.size

Size of tick lables of Y-axis.

References

Johnson, R. A. and Wichern, D. W. (2002) Applied Multivariate Statistical Analysis, Fifth Edition, Prentice Hall.

See Also

regcr, ellipse

Examples

Run this code
## Produce a 95% ellipse with the specified mean and covariance structure.
mu <- c(1, 3)
sigma <- matrix(c(1, .3, .3, 1.5), 2, 2)
plotly_ellipse(mu, sigma, npoints = 200)

Run the code above in your browser using DataLab