| StatSankeyedge {ggsankeyfier} | R Documentation |
Sankey stats
Description
Aggregates value on the y axis per group for nodes, and for all used aesthetics for
edges.
Usage
StatSankeyedge
stat_sankeyedge(
mapping = NULL,
data = NULL,
geom = "sankeyedge",
position = "sankey",
na.rm = FALSE,
slope = 0.5,
ncp = 100,
show.legend = NA,
inherit.aes = TRUE,
...
)
StatSankeynode
stat_sankeynode(
mapping = NULL,
data = NULL,
geom = "sankeynode",
position = "sankey",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
a string naming the |
position |
A |
na.rm |
If |
slope |
Slope parameter ( |
ncp |
Number of control points on the Bezier curve that forms the edge. Larger numbers will result in smoother curves, but cost more computational time. Default is 100. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Passed to |
Format
An object of class StatSankeyedge (inherits from Stat, ggproto, gg) of length 4.
An object of class StatSankeynode (inherits from Stat, ggproto, gg) of length 3.
Details
Wrangles data before it can be passed to position_sankey().
Value
Returns a ggplot2 stat layer which can be used in a ggplot.
Author(s)
Pepijn de Vries
Examples
library(ggplot2)
data("ecosystem_services")
p <- ggplot(ecosystem_services_pivot1, aes(x = stage, y = RCSES, group = node,
connector = connector, edge_id = edge_id,
fill = node))
p + stat_sankeynode()
p + stat_sankeyedge()