# 'devtools' need to be installed if not installed
install.packages("devtools")
# load devtools
library(devtools)
# install 'arcdiagram'
install_github('arcdiagram', username='gastonstat')
library(arcdiagram)
# star graph with 20 nodes
star_graph = graph.star(20, mode="out")
# extract edgelist
staredges = get.edgelist(star_graph)
# default arc diagram
arcplot(staredges)
# different ordering, arc widths, arc colors, and node sizes
set.seed(1234)
orderv <- sample (1:20)
labelv <- paste("nd",1:20,sep="-")
archlinewd <- 4*runif(20,.5,2)
colarcs <- heat.colors (19)
nodesize <- runif(20,1,3)
arcplot(staredges, ordering=orderv, labels= labelv,
lwd.arcs= archlinewd, col.arcs= colarcs,
show.nodes=TRUE, pch.nodes=21, cex.nodes= nodesize,
col.nodes="lightseagreen", bg.nodes="midnightblue", lwd.nodes= 2)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.