forked from tidyverse/ggplot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeom_curve.Rd
77 lines (63 loc) · 2.66 KB
/
geom_curve.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
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/geom-curve.r
\name{geom_curve}
\alias{geom_curve}
\title{Single curved line segments.}
\usage{
geom_curve(mapping = NULL, data = NULL, stat = "identity",
position = "identity", curvature = 0.5, angle = 90, ncp = 5,
arrow = NULL, lineend = "butt", na.rm = FALSE, ...)
}
\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 data frame. If specified, overrides the default data frame
defined at the top level of the plot.}
\item{stat}{The statistical transformation to use on the data for this
layer, as a string.}
\item{position}{Postion adjustment, either as a string, or the result of
a call to a position adjustment function.}
\item{curvature}{A numeric value giving the amount of curvature.
Negative values produce left-hand curves, positive values
produce right-hand curves, and zero produces a straight line.}
\item{angle}{A numeric value between 0 and 180,
giving an amount to skew the control
points of the curve. Values less than 90 skew the curve towards
the start point and values greater than 90 skew the curve
towards the end point.}
\item{ncp}{The number of control points used to draw the curve.
More control points creates a smoother curve.}
\item{arrow}{A list describing arrow heads to place at either end
of the curve, as produced by the \code{arrow} function.}
\item{lineend}{Line end style (round, butt, square)}
\item{na.rm}{If \code{FALSE} (the default), removes missing values with
a warning. If \code{TRUE} silently removes missing values.}
\item{...}{Arguments to be passed to \code{curveGrob}.}
}
\description{
Single curved line segments.
}
\section{Aesthetics}{
\Sexpr[results=rd,stage=build]{ggplot2:::rd_aesthetics("geom", "curve")}
}
\examples{
# Adding curve segments
b <- ggplot(mtcars, aes(wt, mpg)) +
geom_point()
df <- data.frame(x1 = 2.62, x2 = 3.57, y1 = 21.0, y2 = 15.0)
b +
geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2, colour = "curve"), data = df) +
geom_segment(aes(x = x1, y = y1, xend = x2, yend = y2, colour = "segment"), data = df)
b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = -0.2)
b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = 1)
b + geom_curve(
aes(x = x1, y = y1, xend = x2, yend = y2),
data = df,
arrow = grid::arrow(length = grid::unit(0.03, "npc"))
)
}
\seealso{
\code{\link{geom_segment}}, \code{\link{geom_path}} and
\code{\link{geom_line}} for multi-segment lines and paths.
}