scale_resect | R Documentation |
Arrow geoms have a resect
aesthetic that controls how much an arrow should
be shortened. These scales can help to rescale the output range of resection.
scale_resect_continuous(
...,
range = NULL,
aesthetics = c("resect_head", "resect_fins"),
guide = "none"
)
scale_resect_discrete(
...,
values = NULL,
aesthetics = c("resect_head", "resect_fins"),
range = NULL,
guide = "none"
)
... |
Arguments passed on to
|
range |
A numeric vector of length 2 indicating the minimum and maximum
size of the resection after transformation in millimetres. |
aesthetics |
The names of the aesthetics that this scale works with. |
guide |
A function used to create a guide or its name. See
|
values |
(Discrete scale only) A numeric vector to map data values to.
The values will be matched in order with the limits of the scale, or with
|
Conceptually, these scales depart slightly from ggplot2 conventions. The
scale_resect_continuous()
function returns an identity scale
when range = NULL
(default) and a typical continuous scale when the
range
argument is set.
The scale_resect_discrete()
acts as a manual scale when values
is set
and as an ordinal scale when range
is set.
A <Scale>
that can be added to a plot.
# A plot with points indicating path ends
p <- ggplot(whirlpool(5), aes(x, y, colour = group)) +
geom_point(data = ~ subset(.x, arc == ave(arc, group, FUN = max)))
# Resect scale as an identity scale
p + geom_arrow(aes(resect_head = as.integer(group))) +
scale_resect_continuous()
# Resect scale as typical continuous scale
p + geom_arrow(aes(resect_head = as.integer(group))) +
scale_resect_continuous(range = c(0, 10))
# Resect scale as manual scale
p + geom_arrow(aes(resect_head = group)) +
scale_resect_discrete(values = c(10, 5, 0, 5, 10))
# Resect scale as ordinal scale
p + geom_arrow(aes(resect_head = group)) +
scale_resect_discrete(range = c(0, 10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.