forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstat_ellipse.Rd
84 lines (69 loc) · 3.09 KB
/
stat_ellipse.Rd
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/stat-ellipse.R
\name{stat_ellipse}
\alias{stat_ellipse}
\title{Plot data ellipses.}
\usage{
stat_ellipse(mapping = NULL, data = NULL, geom = "path",
position = "identity", type = "t", level = 0.95, segments = 51,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ...)
}
\arguments{
\item{mapping}{The aesthetic mapping, usually constructed with
\code{\link{aes}} or \code{\link{aes_string}}. Only needs to be set
at the layer level if you are overriding the plot defaults.}
\item{data}{A layer specific dataset - only needed if you want to override
the plot defaults.}
\item{geom}{The geometric object to use display the data}
\item{position}{The position adjustment to use for overlapping points
on this layer}
\item{type}{The type of ellipse.
The default \code{"t"} assumes a multivariate t-distribution, and
\code{"norm"} assumes a multivariate normal distribution.
\code{"euclid"} draws a circle with the radius equal to \code{level},
representing the euclidean distance from the center.
This ellipse probably won't appear circular unless \code{coord_fixed()} is applied.}
\item{level}{The confidence level at which to draw an ellipse (default is 0.95),
or, if \code{type="euclid"}, the radius of the circle to be drawn.}
\item{segments}{The number of segments to be used in drawing the ellipse.}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.}
\item{inherit.aes}{If \code{FALSE}, overrides the default aesthetics,
rather than combining with them. This is most useful for helper functions
that define both data and aesthetics and shouldn't inherit behaviour from
the default plot specification, e.g. \code{\link{borders}}.}
\item{...}{other arguments passed on to \code{\link{layer}}. This can
include aesthetics whose values you want to set, not map. See
\code{\link{layer}} for more details.}
}
\description{
Plot data ellipses.
}
\details{
The method for calculating the ellipses has been modified from car::ellipse (Fox and Weisberg, 2011)
}
\examples{
ggplot(faithful, aes(waiting, eruptions))+
geom_point()+
stat_ellipse()
ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3))+
geom_point()+
stat_ellipse()
ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3))+
geom_point()+
stat_ellipse(type = "norm", linetype = 2)+
stat_ellipse(type = "t")
ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3))+
geom_point()+
stat_ellipse(type = "norm", linetype = 2)+
stat_ellipse(type = "euclid", level = 3)+
coord_fixed()
ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3))+
stat_ellipse(geom = "polygon")
}
\references{
John Fox and Sanford Weisberg (2011). An {R} Companion to Applied Regression, Second Edition. Thousand Oaks CA: Sage. URL: http://socserv.socsci.mcmaster.ca/jfox/Books/Companion
}