get.ggplot_ggnet.custom: Plot a network with ggplot2 based on GGally::ggnet

Usage Arguments

Usage

1
2
3
4
5
6
7
8
get.ggplot_ggnet.custom(net, mode = "fruchtermanreingold",
  layout.par = NULL, size = 12, alpha = 0.75, weight.method = "none",
  names = c("", ""), node.group = NULL, node.color = NULL,
  node.alpha = NULL, segment.alpha = NULL, segment.color = "grey",
  segment.label = NULL, segment.size = 0.25, arrow.size = 0,
  label.nodes = FALSE, label.size = size/2, top8.nodes = FALSE,
  trim.labels = TRUE, quantize.weights = FALSE, subset.threshold = 0,
  legend.position = "right", organise.sl = TRUE, ...)

Arguments

net

an object of class igraph or network. If the object is of class igraph, the intergraph package is used to convert it to class network.

mode

a placement method from the list of modes provided in the sna package. Defaults to the Fruchterman-Reingold force-directed algorithm. If mode is set to "geo" and net contains two vertex attributes called "lat" and "lon", these are used instead for geographic networks.

layout.par

options to the placement method, as listed in gplot.layout.

size

size of the network nodes. Defaults to 12. If the nodes are weighted, their area is proportionally scaled up to the size set by size.

alpha

a level of transparency for nodes, vertices and arrows. Defaults to 0.75.

weight.method

a weighting method for the nodes. Accepts "indegree", "outdegree" or "degree" (the default). Set to "none" to plot unweighted nodes.

names

a character vector of two elements to use as legend titles for the node groups and node weights. Defaults to empty strings.

node.group

a vector of character strings to label the nodes, of the same length and order as the vertex names. Factors are converted to strings prior to plotting.

node.color

a vector of character strings to color the nodes, holding as many colors as there are levels in node.group. Tries to default to "Set1" if missing.

node.alpha

transparency of the nodes. Inherits from alpha.

segment.alpha

transparency of the vertex links. Inherits from alpha.

segment.color

color of the vertex links. Defaults to "grey".

segment.label

labels for the vertex links at mid-edges. Label size will be set to 1 / segment.size, and label alpha will inherit from alpha.

segment.size

size of the vertex links, as a vector of values or as a single value. Defaults to 0.25.

arrow.size

size of the vertex arrows for directed network plotting, in centimeters. Defaults to 0.

label.nodes

label nodes with their vertex names attribute. If TRUE, all nodes are labelled. Also accepts a vector of character strings to match with vertex names.

top8.nodes

use the top 8 nodes as node groups, colored with "Set1". The rest of the network will be plotted as the ninth (grey) group. Experimental.

trim.labels

removes '@', 'http://', 'www.' and the ending '/' from vertex names. Cleans up labels for website and Twitter networks. Defaults to TRUE.

quantize.weights

breaks node weights to quartiles. Fails when quartiles do not uniquely identify nodes.

subset.threshold

deletes nodes prior to plotting, based on weight.method < subset.threshold. If weight.method is unspecified, total degree (Freeman's measure) is used. Defaults to 0 (no subsetting).

legend.position

location of the captions for node colors and weights. Accepts all positions supported by ggplot2 themes. Defaults to "right".

...

other arguments supplied to geom_text for the node labels. Arguments pertaining to the title or other items can be achieved through ggplot2 methods.

geo.outliers

when mode is set to "geo", trim geographic outliers (10

Plot a network with ggplot2 based on GGally::ggnet ggnet.custom is based on GGally::gget and returns two objects: the network and the matrix with the coordinates of each edge of the network. This funtion, used in get.plot, is based on ggnet function from Gapply package coded by Moritz Marbach and Francois Briatte for details see https://github.com/briatte/ggnet/blob/master/ggnet.R

The weight.method argument produces visually scaled nodes that are proportionally sized to their unweighted degree. To compute weighted centrality or degree measures, see Tore Opsahl's tnet package. Moritz Marbach and Francois Briatte for the core function. Pierre Rivière for the little changes in the output. get.plot


priviere/shinemas2R_deprecated documentation built on May 8, 2019, 1:21 p.m.