Extra Coordinate Systems, 'Geoms', Statistical Transformations, Scales and Fonts for 'ggplot2'
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.3 KiB

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom_encircle.r
\name{geom_encircle}
\alias{geom_encircle}
\title{encircle}
\usage{
geom_encircle(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
}
\arguments{
\item{mapping}{mapping}
\item{data}{data}
\item{stat}{stat}
\item{position}{position}
\item{na.rm}{na.rm}
\item{show.legend}{show.legend}
\item{inherit.aes}{inherit.aes}
\item{...}{dots}
}
\value{
adds a circle around the specified points
}
\description{
encircle
}
\examples{
d <- data.frame(x=c(1,1,2),y=c(1,2,2)*100)
(g0 <- ggplot(d,aes(x,y))+geom_point()+
geom_encircle(s_shape=1,expand=0)+
geom_encircle(s_shape=1,expand=0.1,colour="red")+
scale_x_continuous(expand=c(0.5,1))+
scale_y_continuous(expand=c(0.5,1))+
geom_encircle(s_shape=0.5,expand=0.1,colour="purple"))
g0 + geom_encircle(data=subset(d,x==1),colour="blue",spread=0.02)+
geom_encircle(data=subset(d,x==2),colour="cyan",spread=0.04)
g0 <- ggplot(mpg, aes(displ, hwy)) + geom_point()
(g1 <- g0 + geom_encircle(data=subset(mpg,hwy>40)))
ss <- subset(mpg,hwy>31 & displ<2)
g1 + geom_point(data=ss,colour="blue")+
geom_encircle(data=ss,colour="blue",s_shape=0.9,
expand=0.07)
}
\author{
Ben Bolker
}