Description Usage Arguments Value
These functions translate an edge list into a positioned
node list, and augment the edge list with the positions
in the node list. Suppose you have only an edges file Edge with columns
from, to, strength, age. Make the corresponding Vertex file:
V <- edgesToVertices( Edge, from=from,to=to )
V will be a vertices file with x and y assigned
Or, if you already have a V with x and y, skip the edgesToVertices
step.
Now augment the Edge dataframe with the positions
x, y, xend, yend
E <- edgesForPlotting( V, ID=ID, x=x, y=y, Edges, from=from, to=to)
Now you can plot E and V
ggplot() +
geom_segment(E,aes(x=x,y=y,yend=yend,xend=xend)) +
geom_point( V, aes(x=x,y=y) ) +
geom_text( V, aes(x=x,y=y,label=ID))
1 | edgesToVertices(Edges, from, to)
|
|
Data frame giving, at a minimum, the names of the nodes arranged as an edgelist: <to> and <from> columns where each case is one edge. |
|
Name of the <from> variable in the edgelist |
|
Name of the <from> variable in the edgelist |
|
a data frame containing vertex IDs and x,y coordinates for each vertex. |
|
variable containing the ID of the vertices |
|
variable holding x-position of vertex |
|
variable holding y-position of vertex |
|
dataframe containing the from and to connection for each edge. from and to should be drawn from the same set as ID in Vertices. |
A data frame containing all the vertex IDs, with x and y positions for each one.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.