Monday, April 29, 2013

RG#94: Arch Diagram

# 'devtools' need to be installed if not installed 

# load devtools

# install 'arcdiagram'
install_github('arcdiagram',  username='gastonstat')

# star graph with 20 nodes
star_graph =, mode="out")

# extract edgelist
staredges = get.edgelist(star_graph)

# default arc diagram
 # different ordering, arc widths, arc colors, and node sizes
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.