Learn R Programming

sna (version 0.3)

gplot: 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="mds", 
    displayisolates=TRUE, pad=0, label.cex=1, vertex.cex=1, 
    label.col=1, edge.col=1, vertex.col=1, arrowhead.length=0.2, 
    edge.type=1, ...)

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. 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'', or ``rmds''.
displayisolates
Should we display isolates?
pad
Amount to pad the plotting range; useful if labels are being clipped.
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.
...
Additional arguments to plot.

Value

  • None.

Requires

mva

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.

References

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

See Also

plot

Examples

Run this code
gplot(rgraph(5))  #Plot a random graph

Run the code above in your browser using DataLab