stefpeschel / NetCoMi

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

Labels of NetCoMi:::plot.microNetProps #43

Closed Dichromatism closed 2 years ago

Dichromatism commented 2 years ago

Hi! I am using NetCoMi with SPRING these days and find it very useful when comparing different communities. While I was using NetCoMi:::plot.microNetProps, I found that an error came out when only one group (i.e., I just put one community inside) were analyzed as

Error in if (any(cexLabels1 == 0)) { : missing value where TRUE/FALSE needed

when I set labels = FALSE. The error did not appear when I set different groups in and no labels were displayed in the plot.

What I want was to get a single network with no labels so I wrote like this:

plot(props_Rfr, 
     layout = "layout_with_fr",
     labels = FALSE,
     nodeColor = "feature",
     repulsion = 1.2,
     featVecCol = phyla,
     colorVec = phycol,
     rmSingles = "all",
     nodeSize = "mclr",
     cexNodes = 1.5,
     cexLabels = FALSE,
     cexHubLabels = 3,
     cexTitle = 3.8,
     nodeTransp = 20,
     borderWidth = 2
)

Why did it happen?

Thanks!

stefpeschel commented 2 years ago

Hey @Dichromatism,

You're right, setting labels to FALSE (or TRUE) doesn't work in the current version. The bug will be fixed in the next update, but for now, labels can be suppressed by setting cexLabels = 0 and cexHubLabels = 0. You can also print only the hub labels by setting only cexHubLabels to a positive value.

Best, Stefanie

Dichromatism commented 2 years ago

Thanks for your advice! I could plot labels=FALSE graphs several days before but from the day I raised this issue, it couldn't work anymore, which was weird. Hope this information will help.

Fred-White94 commented 2 years ago

Just to let you know, I downloaded using the installation:

install.packages("devtools")

devtools::install_github("stefpeschel/NetCoMi", dependencies = TRUE, repos = c("https://cloud.r-project.org/", BiocManager::repositories()))

and I still have the same issue as above if i use labels=FALSE

otherwise, cheers for the package

stefpeschel commented 2 years ago

Thanks for your message. The fix was only implemented on develop branch so far, however, I just published a new release, where the issue is fixed. So, I'll close this issue now.

Best, Stefanie