Skip to content

Instantly share code, notes, and snippets.

@SachaEpskamp
Created June 13, 2019 07:25
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 SachaEpskamp/c14b288903a2f699e821ad175dcc2577 to your computer and use it in GitHub Desktop.
Save SachaEpskamp/c14b288903a2f699e821ad175dcc2577 to your computer and use it in GitHub Desktop.
library("qgraph")
library("bootnet")
# Number of nodes:
nNode <- 10
# Make a list with intervals:
intervals <- replicate(nNode,sort(runif(2,0.5,1)),simplify = FALSE)
# Rescale intervals so they represent difference:
pieList <- lapply(intervals,function(x)diff(c(0,x)))
# Colors:
col <- c(0.95,0.2)
pieColors <- replicate(nNode, rgb(col,col,col), simplify = FALSE)
# Some network:
net <- genGGM(nNode, p = 0.4, nei = 2)
# Plot:
layout(1)
qgraph(net, pie = pieList, pieColor = pieColors, layout = "spring",
vsize = 15, pieBorder = 0.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment