Learn R Programming

ggraph (version 2.0.5)

guide_edge_direction: Edge direction guide

Description

This guide is intended to show the direction of edges based on the aesthetics mapped to its progression, such as changing width, colour and opacity.

Usage

guide_edge_direction(
  title = waiver(),
  title.position = NULL,
  title.theme = NULL,
  title.hjust = NULL,
  title.vjust = NULL,
  arrow = TRUE,
  arrow.position = NULL,
  barwidth = NULL,
  barheight = NULL,
  nbin = 500,
  direction = NULL,
  default.unit = "line",
  reverse = FALSE,
  order = 0,
  override.aes = list(),
  ...
)

Arguments

title

A character string or expression indicating a title of guide. If NULL, the title is not shown. By default (waiver()), the name of the scale object or the name specified in labs() is used for the title.

title.position

A character string indicating the position of a title. One of "top" (default for a vertical guide), "bottom", "left" (default for a horizontal guide), or "right."

title.theme

A theme object for rendering the title text. Usually the object of element_text() is expected. By default, the theme is specified by legend.title in theme() or theme.

title.hjust

A number specifying horizontal justification of the title text.

title.vjust

A number specifying vertical justification of the title text.

arrow

Logical. Should an arrow be drawn to illustrate the direction. Defaults to TRUE

arrow.position

The position of the arrow relative to the example edge.

barwidth

A numeric or a grid::unit() object specifying the width of the colourbar. Default value is legend.key.width or legend.key.size in theme() or theme.

barheight

A numeric or a grid::unit() object specifying the height of the colourbar. Default value is legend.key.height or legend.key.size in theme() or theme.

nbin

A numeric specifying the number of bins for drawing the colourbar. A smoother colourbar results from a larger value.

direction

A character string indicating the direction of the guide. One of "horizontal" or "vertical."

default.unit

A character string indicating grid::unit() for barwidth and barheight.

reverse

logical. If TRUE the colourbar is reversed. By default, the highest value is on the top and the lowest value is on the bottom

order

positive integer less than 99 that specifies the order of this guide among multiple guides. This controls the order in which multiple guides are displayed, not the contents of the guide itself. If 0 (default), the order is determined by a secret algorithm.

override.aes

A list specifying aesthetic parameters of legend key.

...

ignored.

Examples

Run this code
gr <- tidygraph::as_tbl_graph(highschool)
ggraph(gr, layout = 'kk') +
  geom_edge_fan(aes(alpha = stat(index))) +
  guides(edge_alpha = guide_edge_direction())

Run the code above in your browser using DataLab