gplot {sna}R Documentation

Two-Dimensional Visualization of Graphs

Description

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.

Usage

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), ...)

Arguments

dat A graph or graph stack. This data may be valued.
g Integer indicating the index of the graph which is to be plotted. By default, g==1.
gmode String indicating the type of graph being evaluated. "digraph" indicates that edges should be interpreted as directed; "graph" indicates that edges are undirected; "twomode" indicates that data should be interpreted as bimodal (i.e., rows and columns are distinct vertex sets). gmode is set to "digraph" by default.
diag Boolean indicating whether or not the diagonal should be treated as valid data. Set this true if and only if the data can contain loops. diag is FALSE by default.
label A vector of vertex labels, if desired; defaults to the vertex index number.
coord User-specified vertex coordinates, in an nx2 matrix. Where this is specified, it will override the mode setting.
jitter Should the output be jittered?
thresh Real number indicating the lower threshold for tie values. Only ties of value >thresh are displayed. By default, thresh=0.
usearrows Should arrows (rather than line segments) be used to indicate edges?
mode The vertex placement algorithm. This must be one of "princoord", "eigen", "mds", "random", "circle", "circrand", "rmds", "geodist", "adj", "seham", "spring", or "springrepulse".
displayisolates Should we display isolates?
boxed.labels Place vertex labels within boxes?
xlab X axis label
ylab Y axis label
pad Amount to pad the plotting range; useful if labels are being clipped
vertex.pch Character type for vertices; may be given as a vector, if vertices are to be of different types
label.cex Character expansion factor for label text
vertex.cex Character expansion factor for vertices
label.col A vector of colors for labels
edge.col A vector of colors for edges
vertex.col A vector of colors for vertices
arrowhead.length If arrows are used for edges, how long should the arrowhead be?
edge.type Line type for edges
edge.lwd Line width scale for edges; if set greater than 0, edge widths are given by edge.lwd*dat
suppress.axes Suppress plotting of axes?
embedder.params A vector of parameters for the spring and springrepulse modes; see below
... Additional arguments to plot

Details

gplot 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:

  1. random: Vertices are placed (uniformly) randomly within a square region about the origin.
  2. circle: Vertices are placed evenly about the unit circle.
  3. 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.
  4. eigen, princoord: Vertices are placed via (the real components of) the first two eigenvectors of:
    1. eigen: the matrix of correlations among (concatenated) rows/columns of the adjacency matrix
    2. princoord: the raw adjacency matrix.
  5. mds, rmds, geodist, adj, seham: Vertices are placed by a metric MDS. The distance matrix used is given by:
    1. mds: absolute row/column differences within the adjacency matrix
    2. rmds: euclidean distances between rows of the adjacency matrix
    3. geodist: geodesic distances between vertices within the graph
    4. adj: (max A)-A, where A is the raw adjacency matrix
    5. seham: structural (dis)equivalence distances (i.e., as per sedist) based on the Hamming metric
  6. spring, springrepulse: Vertices are placed using a simple spring embedder. Parameters for the embedding model are given by embedder.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. If springrepulse is 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.

Value

None.

Requires

mva

Author(s)

Carter T. Butts buttsc@uci.edu

References

Wasserman, S., and Faust, K. (1994). ``Social Network Analysis: Methods and Applications.'' Cambridge: Cambridge University Press.

See Also

plot

Examples

gplot(rgraph(5))  #Plot a random graph

[Package Contents]