| plot3D.graph {ivue} | R Documentation |
Draw a Weighted Embedded Graph
Description
Graph input is normalized independently of the rendering engine. Supplied coordinates never trigger layout computation or igraph construction.
Usage
plot3D.graph(
graph,
X = NULL,
layout = NULL,
vertices = NULL,
directed = NULL,
weight.type = NULL,
seed = 1L,
edge.col = "gray65",
edge.width = 1,
values = NULL,
groups = NULL,
layers = list(),
...
)
Arguments
graph |
A named list with adj.list and weight.list (neighbors are row
indices); a list with edges and vertices; a weighted data frame with from,
to, weight columns plus the vertices argument; a numerical square adjacency
matrix; a Matrix sparse adjacency matrix; or an igraph object. Matrices use
zero for absent edges; use lists/tables to represent zero-weight edges.
A graph returned by |
X |
Finite n-by-3 coordinates. Unnamed rows follow vertex order; named rows must match vertex IDs exactly and are aligned to graph vertex order. |
layout |
NULL when X is supplied, otherwise "fr", "kk", or a function of the normalized graph returning n-by-3 coordinates. Supply exactly one of X and layout. Custom functions receive vertices (id plus attributes), edges (integer from/to indices, weight, attributes), directed, weight.type. |
vertices |
Explicit vertex IDs or a data frame with a unique id column. Required for edge-table input, including isolated vertices. Adjacency lists default to list names, or character row numbers when unnamed. |
directed |
Logical directedness; NULL uses stored directedness or FALSE. This release rejects directed rendering, self-loops, and parallel edges. Undirected adjacency lists must be reciprocal with equal weights. |
weight.type |
"distance", "strength", or "unweighted". Required for weighted layout algorithms but not supplied-coordinate drawing. The fr algorithm requires strengths; kk requires distances. No inversion occurs. Unweighted mode only accepts missing or unit weights. |
seed |
Seed used locally for layout computation, without changing the caller's random-number state. |
edge.col, edge.width |
Explicit visual attributes, scalar or one per normalized edge. They are not automatically inferred from weights. |
values, groups |
Optional vertex coloring. Unnamed vectors follow graph
vertex order. Named vectors must match vertex IDs exactly and are reordered
to that order; partial, duplicate, missing, or extra names are rejected.
Supply at most one; scales and legends use the corresponding point family.
Default categorical colors use factor levels or first occurrence in the
supplied annotation vector, before ID alignment, as in |
layers |
Additional layer3D specifications. |
... |
Named controls for the selected point family. Legacy graph-layout and basin arguments are not supported. |
Details
Only fr and kk need igraph. Negative and zero finite weights can be
stored/drawn, but these layout algorithms require positive weights.
Explicit sparse zeros are rejected because zero-edge semantics would be
ambiguous. Duplicate/asymmetric adjacency entries are rejected, not averaged.
igraph vertex names supply canonical IDs; a pre-existing id attribute is
retained as .igraph.id (an existing .igraph.id attribute is a conflict).
Named per-vertex col, highlight-style color vectors, and logical
highlight masks use the same exact-ID alignment as values/groups.
Unnamed scalar colors are recycled. Numeric highlight indices always refer
to graph vertex order, not the supplied coordinate row order.
Value
A widget with normalized graph data in attr(widget, "ivue")$graph. Its observation.ids are graph vertex IDs; row.ids remain integer positions in graph vertex order.
See Also
prepare.graph(), plot3D.plain(), layer3D.edges()
Examples
g <- list(adj.list = list(2L, c(1L, 3L), 2L, integer()),
weight.list = list(2, c(2, 4), 4, numeric()))
X <- rbind(c(0, 0, 0), c(1, 1, 0), c(2, 0, 1), c(0, 2, 1))
if (nzchar(system.file(package = "rgl"))) w <- plot3D.graph(g, X = X)