Learn R Programming

sna (version 2.7-1)

gplot3d: Three-Dimensional Visualization of Graphs

Description

gplot3d produces a three-dimensional plot of graph g in set dat. A variety of options are available to control vertex placement, display details, color, etc.

Usage

gplot3d(dat, g = 1, gmode = "digraph", diag = FALSE, 
    label = NULL, coord = NULL, jitter = TRUE, thresh = 0,
    mode = "fruchtermanreingold", displayisolates = TRUE, 
    displaylabels = !missing(label), xlab = NULL, ylab = NULL, 
    zlab = NULL, vertex.radius = NULL, absolute.radius = FALSE, 
    label.col = "gray50", edge.col = "black", vertex.col = NULL, 
    edge.alpha = 1, vertex.alpha = 1, edge.lwd = NULL, suppress.axes = TRUE,
    new = TRUE, bg.col = "white", layout.par = NULL)

Value

A three-column matrix containing vertex coordinates

Arguments

dat

a graph or set thereof. This data may be valued.

g

integer indicating the index of the graph (from dat) which is to be displayed.

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 two-mode (i.e., rows and columns are distinct vertex sets).

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.

label

a vector of vertex labels; setting this to a zero-length string (e.g., "") omits

coord

user-specified vertex coordinates, in an NCOL(dat)x3 matrix. Where this is specified, it will override the mode setting.

jitter

boolean; should vertex positions be jittered?

thresh

real number indicating the lower threshold for tie values. Only ties of value >thresh are displayed.

mode

the vertex placement algorithm; this must correspond to a gplot3d.layout function.

displayisolates

boolean; should isolates be displayed?

displaylabels

boolean; should vertex labels be displayed?

xlab

X axis label.

ylab

Y axis label.

zlab

Z axis label.

vertex.radius

vertex radius, relative to the baseline (which is set based on layout features); may be given as a vector, if radii vary across vertices.

absolute.radius

vertex radius, specified in absolute terms; this may be given as a vector.

label.col

color for vertex labels; may be given as a vector, if labels are to be of different colors.

edge.col

color for edges; may be given as a vector or adjacency matrix, if edges are to be of different colors.

vertex.col

color for vertices; may be given as a vector, if vertices are to be of different colors. By default, red is used (or red and blue, if gmode=="twomode").

edge.alpha

alpha (transparency) values for edges; may be given as a vector or adjacency matrix, if edge transparency is to vary.

vertex.alpha

alpha (transparency) values for vertices; may be given as a vector, if vertex transparency is to vary.

edge.lwd

line width scale for edges; if set greater than 0, edge widths are rescaled by edge.lwd*dat. May be given as a vector or adjacency matrix, if edges are to have different line widths.

suppress.axes

boolean; suppress plotting of axes?

new

boolean; create a new plot? If new==FALSE, the RGL device will not be cleared prior to adding vertices and edges.

bg.col

background color for display.

layout.par

list of parameters to the gplot.layout function specified in mode.

Author

Carter T. Butts buttsc@uci.edu

Requires

rgl

Details

gplot3d is the three-dimensional companion to gplot. As with the latter, clever manipulation of parameters can allow for a great deal of flexibility in the resulting display. (Displays produced by gplot3d are also interactive, to the extent supported by rgl.) If vertex positions are not specified directly using coord, vertex layout is determined via one of the various available algorithms. These should be specified via the mode argument; see gplot3d.layout for a full list. User-supplied layout functions are also possible - see the aforementioned man page for details.

Note that where gmode=="twomode", the supplied two-mode graph is converted to bipartite form prior to computing coordinates (assuming it is not in this form already). It may be desirable to use parameters such as vertex.col to differentiate row and column vertices; by default, row vertices are colored red, and column vertices blue.

References

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

See Also

gplot, gplot3d.layout, rgl

Examples

Run this code

if (FALSE) {
#A three-dimensional grid...
gplot3d(rgws(1,5,3,1,0))

#...rewired...
gplot3d(rgws(1,5,3,1,0.05))

#...some more!
gplot3d(rgws(1,5,3,1,0.2))
}

Run the code above in your browser using DataLab