Based on Prof. Katherine Ognyanova, Rutgers University 2017 Workshop http://kateto.net/network-visualization.
The main concern in designing a network visualization is the purpose it has to serve. What are the structure properties that we want to highlight? What are the key concerns we want to address? Modern graph layouts are optimized for speed and aesthetics. In particular, they seek to minimize overlaps and edge crossing, and ensure similar edge length across the graph.
The main packages we are going to use are igraph (maintained by Gabor Csardi and Tamas Nepusz), sna & network (maintained by Carter Butts and the Statnet team), visNetwork (maintained by Benoit Thieurmel), threejs (maintained by Bryan W. Lewis), NetworkD3 (maintained by Christopher Gandrud), and ndtv (maintained by Skye Bender-deMoll).
install.packages(“igraph”) install.packages(“network”) install.packages(“sna”) install.packages(“visNetwork”) install.packages(“threejs”) install.packages(“networkD3”) install.packages(“ndtv”)
Specify the color in R see # http://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf.
# install.packages('RColorBrewer')
library('RColorBrewer')
# install.packages('extrafont')
library('extrafont')
## Registering fonts with R
plot(x=1:10, y=rep(5,10), pch=19, cex=3, col="red")
points(x=1:10, y=rep(6, 10), pch=19, cex=3, col="mediumblue")
points(x=1:10, y=rep(4, 10), pch=19, cex=3, col="green")
plot(x=1:5, y=rep(5,5), pch=19, cex=24, col=rgb(.25, .5, .3, alpha=.5), xlim=c(0,6))
par(bg="gray40")
col.tr <- grDevices::adjustcolor("557799", alpha=0.7)
plot(x=1:5, y=rep(5,5), pch=19, cex=24, col=col.tr, xlim=c(0,6))
dev.off()
## null device
## 1
pal1 <- heat.colors(5, alpha=1) # 5 colors from the heat palette, opaque
pal2 <- rainbow(5, alpha=.5) # 5 colors from the heat palette, transparent
plot(x=1:10, y=1:10, pch=19, cex=15, col=pal1)
plot(x=1:10, y=1:10, pch=19, cex=15, col=pal2)
display.brewer.all()
display.brewer.pal(8, "Set3")
display.brewer.pal(8, "Spectral")
display.brewer.pal(8, "Blues")
pal3 <- brewer.pal(10, "Set3")
plot(x=10:1, y=10:1, pch=19, cex=16, col=pal3)
Import system fonts - may take a while font_import() fonts() # See what font families are available to you now. loadfonts(device = “win”) # use device = “pdf” for pdf plot output.
plot(x=10:1, y=10:1, pch=19, cex=13,
main="This is a Arial Black Font", col=pal3,
family="Arial Black" ,xlab="X",ylab="Y")