ggflow: ggflow

View source: R/ggflow.R

ggflowR Documentation

ggflow

Description

Draw a flow chart from edge data

Usage

ggflow(
  data,
  layout = igraph::layout_as_tree,
  start_shave = 0.3,
  end_shave = 0.3,
  type_shave = "proportion",
  ...
)

Arguments

data

a data frame with 'from' and 'to' columns, or an igraph object

layout

network layout passed to ggplot.igraph(); the default is igraph::layout_as_tree

start_shave

amount removed from the start of each edge

end_shave

amount removed from the end of each edge, before the arrowhead

type_shave

whether shaving is a proportion of edge length or a distance

...

additional parameters passed to geom_edge() (e.g. arrow)

Details

ggflow() is a thin wrapper around ggplot.igraph() and geom_edge() for from/to edge lists. It used to live in the standalone ggflow package, which is now retired: flow charts are directed graphs, not trees, so they belong here rather than in ggtreeDendro.

Value

a ggplot object

Author(s)

Guangchuang Yu

Examples

library(ggtangle)
d <- data.frame(
  from = c("A", "A", "A", "B", "C", "F"),
  to   = c("B", "C", "D", "E", "F", "G")
)
ggflow(d, arrow = arrow(type = 'closed')) +
    ggfun::geom_scatter_rect(fill = NA, color = 'black') +
    geom_text(aes(label = label), size = 10)

ggtangle documentation built on Dec. 3, 2026, 5:07 p.m.