gplot produces a simple two-dimensional plot of graph g in stack dat. A variety of options are available to control vertex placement, display details, color, etc.gplot(dat, g=1, gmode="digraph", diag=FALSE, label=c(1:dim(dat)[2]),
coord=NULL, jitter=TRUE, thresh=0, usearrows=TRUE,
mode="springrepulse", displayisolates=TRUE, boxed.labels=TRUE,
xlab=NULL, ylab=NULL, pad=0.1, vertex.pch = 19, label.cex=1,
vertex.cex=1, label.col=1, edge.col=1, vertex.col=1,
arrowhead.length=0.2, edge.type=1, edge.lwd = 0,
suppress.axes=TRUE, embedder.params=c(0.001,1,0.01,0.2,0.001), ...)g==1."digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected; "twomode" indicates that data should be interpreteddiag is FALSE by default.mode setting.thresh are displayed. By default, thresh=0."princoord", "eigen", "mds", "random", "circle", "circrand", "rmds", "geodist", "adj"edge.lwd*datspring and springrepulse modes; see belowplotmvagplot is the standard network visualization tool within the sna library. By means of clever selection of display parameters, a fair amount of display flexibility can be obtained. Graph layout -- if not specified directly using coord -- is determined via one of the various available algorithms. These are (briefly) as follows:
random: Vertices are placed (uniformly) randomly within a square region about the origin.circle: Vertices are placed evenly about the unit circle.circrand: Vertices are placed in a ``gaussian donut,'' with distance from the origin following a normal distribution and angle relative to the X axis chosen (uniformly) randomly.eigen,princoord: Vertices are placed via (the real components of) the first two eigenvectors of:eigen: the matrix of correlations among (concatenated) rows/columns of the adjacency matrixprincoord: the raw adjacency matrix.mds,rmds,geodist,adj,seham: Vertices are placed by a metric MDS. The distance matrix used is given by:mds: absolute row/column differences within the adjacency matrixrmds: euclidean distances between rows of the adjacency matrixgeodist: geodesic distances between vertices within the graphadj:$(\max A)-A$, where$A$is the raw adjacency matrixseham: structural (dis)equivalence distances (i.e., as persedist) based on the Hamming metricspring,springrepulse: Vertices are placed using a simple spring embedder. Parameters for the embedding model are given byembedder.params, in the following order: vertex mass; equilibrium extension; spring coefficient; repulsion equilibrium distance; and base coefficient of friction. Initial vertex positions are in random order around a circle, and simulation proceeds -- increasing the coefficient of friction by the specified base value per unit time -- until ``motion'' within the system ceases. Ifspringrepulseis specified, then an inverse-cube repulsion force between vertices is also simulated; this force is calibrated so as to be exactly equal to the force of a unit spring extension at a distance specified by the repulsion equilibrium distance.Note that where gmode=="twomode", the supplied two-mode matrix is converted to bipartite adjacency form prior to computing coordinates.
plotgplot(rgraph(5)) #Plot a random graphRun the code above in your browser using DataLab