forked from gastonstat/arcdiagram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_coords.Rd
61 lines (51 loc) · 1.49 KB
/
node_coords.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
\name{node_coords}
\alias{node_coords}
\title{Node Coordinates}
\usage{
node_coords(edgelist, sorted = FALSE, decreasing = FALSE,
ordering = NULL, labels = NULL)
}
\arguments{
\item{edgelist}{basically a two-column matrix with edges
(see \code{\link{graph}})}
\item{sorted}{logical to indicate if nodes should be
sorted}
\item{decreasing}{logical to indicate type of sorting
(used only when \code{sorted=TRUE})}
\item{ordering}{optional numeric vector providing the
ordering of nodes (when provided, this parameter
overrides \code{sorted=TRUE})}
\item{labels}{character vector with labels for the nodes}
}
\value{
a vector with the location of nodes in the x-axis
}
\description{
Computes axis locations of each node. This function can
be helpful when you want to separately plot the node
labels using the function mtext.
}
\examples{
\dontrun{
# generate a graph
some_graph = graph.ring(10)
# add names to nodes
V(some_graph)$name = letters[1:vcount(some_graph)]
# extract edgelist
edgelist = get.edgelist(some_graph)
# (default) arc diagram
arcplot(edgelist, labels=V(some_graph)$name, las=1)
# get x-axis coordinates of nodes
xcoords = node_coords(edgelist, labels=V(some_graph)$name)
# arc diagram with various labels
arcplot(edgelist, show.labels=FALSE, show.nodes=TRUE)
mtext(V(some_graph)$name, side=1, line=0, at=xcoords)
mtext(rep("node",10), side=1, line=1, at=xcoords, col="gray90")
}
}
\author{
Gaston Sanchez
}
\seealso{
\code{\link{arcplot}}
}