1. modu=membership(modu_network) - This line assigns the module membership of each node in the network modu_network to the vector modu.

  2. color_value =c("yellow","#66FFFF","#7CCD7C","pink") - This line creates a vector color_value with four colors that will be used to represent the different modules in the network.

  3. V(network)$color = color_value[modu] - This line assigns a color to each vertex in the network based on its module membership. The color_value vector is indexed by the modu vector to get the appropriate color for each vertex.

  4. par(bg="white", mar=c(0,0,0,0)) - This line sets the background color of the plot to white and removes the plot margins.

  5. set.seed(123) - This line sets the random number generator seed used for generating the plot layout to a fixed value, ensuring that the plot will be reproducible.

  6. plot(network,vertex.frame.color="black",vertex.size=12,vertex.label.cex=0.6, vertex.label.cex=0.6,vertex.label.color="black") - This line plots the network using the assigned vertex colors and various vertex and label settings.

  7. legend("bottomleft",legend=c("Module 1","Module 2", "Module 3", "Module 4"),col=color_value, bty="n",fill=color_value,border=color_value) - This line adds a legend to the plot, showing the mapping between the module colors and their names. The bty, fill, and border arguments control the appearance of the legend box.

modu=membershipmodu_networkcolor_value =cyellow#66FFFF#7CCD7CpinkVnetwork$color = color_valuemodu parbg=white mar=c0000setseed123plotnetworkvertexframecolor=blackvertexsize=12vertexlabelcex=06 vertexl

原文地址: https://www.cveoy.top/t/topic/b2h4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录