directed_network_plot: A wrapper for plot.igraph for visualizing directed networks.

View source: R/networks.r

directed_network_plotR Documentation

A wrapper for plot.igraph for visualizing directed networks.

Description

This is a convenience function for visualizing directed networks with edge labels using plot.igraph. It was designed specifically for visualizing aggregated document similarity networks in the RNewsflow package, but works with any network in the igraph class.

Usage

directed_network_plot(
  g,
  weight_var = "from.Vprop",
  weight_thres = NULL,
  delete_isolates = FALSE,
  vertex.size = 30,
  vertex.color = "lightblue",
  vertex.label.color = "black",
  vertex.label.cex = 0.7,
  edge.color = "grey",
  show.edge.labels = TRUE,
  edge.label.color = "black",
  edge.label.cex = 0.6,
  edge.arrow.size = 1,
  layout = igraph::layout.davidson.harel,
  ...
)

Arguments

g

A network/graph in the igraph class

weight_var

The edge attribute that is used to specify the edges

weight_thres

A threshold for weight. Edges below the threshold are ignored

delete_isolates

If TRUE, isolates (i.e. vertices without edges) are ignored.

vertex.size

The size of the verticex/nodes. Defaults to 30. Can be a vector with values per vertex.

vertex.color

Color of vertices/nodes. Default is lightblue. Can be a vector with values per vertex.

vertex.label.color

Color of labels for vertices/nodes. Defaults to black. Can be a vector with values per vertex.

vertex.label.cex

Size of the labels for vertices/nodes. Defaults to 0.7. Can be a vector with values per vertex.

edge.color

Color of the edges. Defaults to grey. Can be a vector with values per edge.

show.edge.labels

Logical. Should edge labels be displayed? Default is TRUE.

edge.label.color

Color of the edge labels. Defaults to black. Can be a vector with values per edge.

edge.label.cex

Size of the edge labels. Defaults to 0.6. Can be a vector with values per edge.

edge.arrow.size

Size of the edge arrows. Defaults to 1. Can only be set globally (igraph might update this at some point)

layout

The igraph layout used to plot the network. Defaults to layout.davidson.harel

...

Arguments to be passed to the plot.igraph function.

Value

Nothing

Examples

data(docnet)
aggdocnet = network_aggregate(docnet, by='source')
directed_network_plot(aggdocnet, weight_var = 'to.Vprop', weight_thres = 0.2)

kasperwelbers/RNewsflow documentation built on April 8, 2024, 4:39 p.m.