# NOT RUN {
# 1) generate a random bipartite graph
set.seed(123)
g <- sample_bipartite(100, 50, p=0.1)
V(g)$name <- V(g)
# }
# NOT RUN {
# 2) obtain its community
ig <- xBigraph(g)
gp <- xGGnetwork(ig, node.label='name', node.label.size=2,
node.label.color='black', node.label.alpha=0.8, node.label.padding=0,
node.label.arrow=0, node.label.force=0.002, node.shape='type',
node.shape.title='Type', node.xcoord='xcoord', node.ycoord='ycoord',
node.color='community', node.color.title='Community',
colormap='jet.both', ncolors=64, zlim=NULL, node.size='contribution',
node.size.range=c(1,4), node.size.title='Contribution', slim=NULL,
edge.color="color",edge.color.alpha=0.5,edge.curve=0,edge.arrow.gap=0)
## make it discrete for the colorbar
gp +
scale_colour_gradientn(colors=xColormap('jet.both')(64),breaks=seq(1,max(V(ig)$community)))
+ guides(color=guide_legend(title="Community"))
# }
Run the code above in your browser using DataLab