stefpeschel / NetCoMi

Network construction, analysis, and comparison for microbial compositional data
GNU General Public License v3.0
150 stars 27 forks source link

Could I manually modify the color of each node? #120

Closed ChihYingLu closed 5 months ago

ChihYingLu commented 6 months ago

Dear Stefanie,

Thank you for developing the amazing NetCoMi! I would like to know if it would be possible to manually modify the colors of each node. I have generated a genus-level network by including both control and disease samples. To associate the network result with disease status, I wish to label the node genera that are enriched in the disease status. Roelands (2023) has done something similar but using the NetCoMi output and plotting it in Cytoscape. I wonder if I could directly modify the node color in the NetCoMi package. It seems the "featVecCol" function may serve this purpose, but I couldn't figure it out. Below is the code I used to generate and visualize my network. Thank you very much!

Best, Chih-Ying

` net_genus_1 <- netConstruct(genus_rename_1, taxRank = "Genus", filtTax = "highestFreq", filtTaxPar = list(highestFreq = 60), measure = "sparcc", measurePar = list(nlambda = 50, rep.num = 50), normMethod = "clr", sparsMethod = "threshold", thresh = 0.3, verbose = 3)

props_genus_1 <- netAnalyze(net_genus_1, clustMethod = "cluster_fast_greedy")

plot(props_genus1, edgeInvisFilter = "threshold", edgeInvisPar = 0.4, repulsion = 0.85, shortenLabels = "none", charToRm = "", labelScale = FALSE, rmSingles = TRUE, nodeSize = "clr", nodeSizeSpread = 4, nodeColor = "cluster", posCol = "orange", negCol = "deepskyblue", edgeTranspLow = 0, edgeTranspHigh = 40, cexNodes = 2, cexLabels = 0.75, highlightHubs = FALSE, borderCol = "darkgray", title1 = paste0("Network on genus level with SparCC correlations", "\n(edge filter: threshold = 0.4)"), showTitle = TRUE, cexTitle = 1.2) `

ChihYingLu commented 5 months ago

Sorry! I did not search thoroughly. There is already an answer at #34.

I was also trying to modify specific node text to bold but failed. It might be nice if the node text format could also be modified manually.

stefpeschel commented 5 months ago

Sorry for the late reply and thanks for looking into the other issues. I will add the font manipulation option to my to-do list.