Skip to content

Instantly share code, notes, and snippets.

@goldingn
Last active May 18, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldingn/76ff865c9ca62b082576cc9b9aab658d to your computer and use it in GitHub Desktop.
Save goldingn/76ff865c9ca62b082576cc9b9aab658d to your computer and use it in GitHub Desktop.
# devtools::install_github("briatte/ggnet")
library(network)
library(sna)
library(ggplot2)
library(viridis)
library(ggnet)
# random graph
set.seed(1)
n <- 500
net = rgraph(n, mode = "graph", tprob = 2/n)
net = network(net, directed = FALSE)
# set colours
bg <- viridis(100)[1]
cols <- viridis(2 * n) [(n + 1):(2 * n)]
net %v% "colour" = sample(cols, n)
png('QSIG_network_logo.png',
width = 3000,
height = 3000,
pointsize = 90)
ggnet2(net,
size = 12,
color = cols,
edge.color = grey(0.8)) +
theme(panel.background = element_rect(fill = bg))
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment