| type_ellipse | R Documentation |
Type function for drawing confidence ellipses around grouped points.
type_ellipse(level = 0.95, segments = 100, density = NULL, angle = 45)
level |
Numeric confidence level for the ellipse. Default is |
segments |
Integer number of line segments used to approximate the
ellipse. Default is |
density |
the density of shading lines, in lines per inch. The
default value of |
angle |
the slope of shading lines, given as an angle in degrees (counter-clockwise). |
A confidence ellipse summarizes the spread and correlation of two variables: its axes align with the principal directions of variation, their lengths reflect the standard deviations along those directions, and the overall size is scaled so that (assuming bivariate normality) the specified proportion of observations falls within the boundary.
Operationally, the ellipse is computed from the covariance matrix
(cov) of each group via eigendecomposition
(eigen), scaled by a chi-squared quantile
(qchisq) for the specified confidence level.
Groups with fewer than 3 points are silently dropped.
# "ellipse" type convenience character string
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris, type = "ellipse")
# layer filled ellipse(s) on top of points
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris, theme = "basic")
tinyplot_add(type = "ellipse", fill = 0.2)
# to avoid clipping, it's better to reverse the layering (ellipse first)
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris, theme = "basic",
type = "ellipse", fill = 0.2)
tinyplot_add(type = "p")
# custom confidence level
tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris,
type = type_ellipse(level = 0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.