scale_waist_continuous | R Documentation |
The waist scale can be used to control the waist (i.e., the width of the edge at its centre) of edges in Sankey diagrams, in order to put emphasis on specific edges.
scale_waist_continuous(..., range = c(0, 1))
scale_waist_datetime(..., range = c(0, 1))
scale_waist_binned(..., range = c(0, 1))
scale_waist_discrete(..., range = c(0, 1))
scale_waist_manual(..., values = NULL, breaks = ggplot2::waiver())
scale_waist_identity(..., guide = "none")
... |
arguments passed onto underpinning scale constructors. |
range |
A |
values |
a set of aesthetic values to map data values to. The values
will be matched in order (usually alphabetical) with the limits of the
scale, or with |
breaks |
One of:
|
guide |
Guide to use for this scale. Defaults to |
This scale can be used to scale the centre of a Sankey edge. At one end of the scale the edge will be shaped like an hour glass, at the other end it will be shaped as an apple.
Returns a ggplot2::Scale object which can be added to a ggplot2::ggplot to control the waist of Sankey diagram edges.
Pepijn de Vries
if (requireNamespace("ggplot2")) {
library(ggplot2)
data("ecosystem_services")
p <-
ggplot(ecosystem_services_pivot1, aes(x = stage, y = RCSES, group = node,
connector = connector,
edge_id = edge_id,
waist = RCSES)) +
geom_sankeyedge(v_space = "auto", ncp = 10) +
geom_sankeynode(v_space = "auto")
p + scale_waist_binned(range = c(0.1, 2))
p + scale_waist_binned(range = c(2, 0.1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.