geom_catenary {ggpointless} | R Documentation |
Draw a catenary curve
Description
geom_catenary()
draws a catenary curve which has a U-like shape,
similar in appearance to a parabola, which it is not.
Usage
geom_catenary(
mapping = NULL,
data = NULL,
stat = "catenary",
position = "identity",
...,
chainLength = NULL,
show.legend = NA,
inherit.aes = TRUE,
na.rm = FALSE
)
stat_catenary(
mapping = NULL,
data = NULL,
geom = "path",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
chainLength = NULL,
...
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
chainLength |
Length of chain between two points. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
na.rm |
If |
geom , stat |
Use to override the default connection between
|
Details
If a flexible chain or rope is loosely hung between two fixed points, it is a curve called a catenary. Catenary, from Latin word catēna, means "chain".
Aesthetics
geom_catenary()
understands the following aesthetics (required
aesthetics are in bold):
-
x
-
y
alpha
color
group
linetype
linewidth
Examples
dat <- data.frame(
x = c(0, 1, 2),
y = c(1, 2, -3)
)
p <- ggplot(dat, aes(x, y))
p + geom_catenary() +
ylim(-4, NA)
# use chainLength argument to change default behaviour
# if you pick a chain length that is too short, a straight line is
# drawn and a message about minimum chain length is shown
p + geom_catenary(chainLength = 10) +
ylim(-4, NA)