format_fortify: format_fortify

View source: R/utilities.R

format_fortifyR Documentation

format_fortify

Description

a unified function to format network or igraph object.

Usage

format_fortify(
  model,
  nodes = NULL,
  weights = NULL,
  arrow.gap = ifelse(network::is.directed(model), 0.025, 0),
  by = NULL,
  scale = TRUE,
  stringsAsFactors = getOption("stringsAsFactors", FALSE),
  .list_vertex_attributes_fun = NULL,
  .get_vertex_attributes_fun = NULL,
  .list_edges_attributes_fun = NULL,
  .get_edges_attributes_fun = NULL,
  .as_edges_list_fun = NULL
)

Arguments

model

an object of class network or igraph.

nodes

a nodes object from a call to fortify.

weights

the name of an edge attribute to use as edge weights when computing the network layout, if the layout supports such weights (see 'Details'). Defaults to NULL (no edge weights).

arrow.gap

a parameter that will shorten the network edges in order to avoid overplotting edge arrows and nodes; defaults to 0 when the network is undirected (no edge shortening), or to 0.025 when the network is directed. Small values near 0.025 will generally achieve good results when the size of the nodes is reasonably small.

by

a character vector that matches an edge attribute, which will be used to generate a data frame that can be plotted with facet_wrap or facet_grid. The nodes of the network will appear in all facets, at the same coordinates. Defaults to NULL (no faceting).

scale

whether to (re)scale the layout coordinates. Defaults to TRUE, but should be set to FALSE if layout contains meaningful spatial coordinates, such as latitude and longitude.

stringsAsFactors

whether vertex and edge attributes should be converted to factors if they are of class character. Defaults to the value of getOption("stringsAsFactors"), which is FALSE by default: see data.frame.

.list_vertex_attributes_fun

a "list vertex attributes" function.

.get_vertex_attributes_fun

a "get vertex attributes" function.

.list_edges_attributes_fun

a "get edges attributes" function.

.get_edges_attributes_fun

a "get edges attributes" function.

.as_edges_list_fun

a "as edges list" function.

Value

a data.frame object.


ggnetwork documentation built on May 29, 2024, 1:32 a.m.