Skip to contents

plg is TDA's graph drawing command, and a different thing from pltree: it takes the node coordinates and the edges and draws them, with control over node shape and shading, edge curvature and arrowheads. pltree by contrast computes a tree layout and draws edges only.

Usage

tda_pl_graph(p, nodes, edges = NULL, ...)

Arguments

p

a tda_ps session.

nodes

a data frame with the node positions. It needs x and y; id numbers the nodes, defaulting to the row number, grey and shape set gs= and gt=, label a text string instead of the node number (str=), size the node's display size in mm (rd=), and lty, lw, fontsize its line type, line width, and font size (lt=/lw=/fs=).

edges

a data frame of edges with from and to, holding node ids. curve sets rd=, the radius that bends an edge, arrow a pair of arrowhead dimensions, label the value written on the edge (ic=), lty its line type, which is how the two directions of a reciprocal pair are told apart, lw its line width, fontsize the edge label's font size (fs=), and loop, for a self-edge, which side of the node it loops from (dir=).

...

further options for plg, e.g. nmax= (the maximum number of nodes, rarely needed since TDA's default of 100 is usually enough).

Value

The session, with the command added.

Examples

nodes <- data.frame(x = c(1, 3, 1, 3), y = c(2, 2, 1, 1))
edges <- data.frame(from = c(1, 1), to = c(2, 3))
p <- tda_ps(xlim = c(0, 4), ylim = c(0, 3), width = 40, height = 30)
p <- tda_pl_graph(p, nodes, edges)