Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does the ggnetwork function in ggplot2 work?


Asked by Antonio Jones on Dec 04, 2021 FAQ



The ggnetwork package is organised around a ‘workhorse’ function of the same name, which will ‘flatten’ the network object to a data frame that contains the edge list of the network, along with the edge attributes and the vertex attributes of the sender nodes.
In addition,
The ggnet2 function is a visualization function to plot network objects as ggplot2 objects. It accepts any object that can be coerced to the network class, including adjacency or incidence matrices, edge lists, or one-mode igraph network objects.
Consequently, Plotting with ggplot2. ggplot2 is a plotting package that makes it simple to create complex plots from data in a data frame. It provides a more programmatic interface for specifying what variables to plot, how they are displayed, and general visual properties.
Keeping this in consideration,
autoplot () is an extension mechanism for ggplot2: it provides a way for package authors to add methods that work like the base plot () function, generating useful default plots with little user interaction. fortify () turns objects into tidy data frames: it has largely been superceded by the broom package.
Besides,
The package dependencies of ggnet2 are, on the one hand, the network and sna packages for network manipulation, and the ggplot2 package for plot construction. library(network) library(sna) library(ggplot2) The ggplot2 package will also load the scales package, which is used internally by ggnet2.