View source: R/geom_pointpath.R
geom_pointpath | R Documentation |
The point path geom is used to make a scatterplot wherein the points are
connected with lines in some order. This geom intends to mimic the
type = 'b'
style of base R line plots.
geom_pointpath(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
arrow = NULL,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
arrow |
Arrow specification as created by
|
inherit.aes |
If |
The mult
is a numeric value to
scale the proportion of gaps in the line around points.
While the need for this geom is not very apparent, since it can be approximated in a variety of ways, the trick up its sleeve is that it dynamically adapts the inter-point segments so these don't deform under different aspect ratios or device sizes.
A Layer ggproto object.
geom_pointpath()
understands the following
aesthetics (required aesthetics are in bold):
x
y
alpha
colour
group
shape
size
stroke
linewidth
linetype
mult
ggplot(pressure, aes(temperature, pressure)) +
geom_pointpath()
# Using geom_pointpath as annotation
ggplot() +
annotate(
"pointpath",
x = c(1, 0.32, 0.31, -0.12, -0.81, -0.4, -0.81, -0.12, 0.31, 0.32, 1),
y = c(0, 0.24, 0.95, 0.38, 0.59, 0, -0.59, -0.38, -0.95, -0.24, 0)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.