Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node names truncated to 6 positions in netAnalyze plot #54

Closed
ranfoxall opened this issue Jul 5, 2022 · 3 comments
Closed

Node names truncated to 6 positions in netAnalyze plot #54

ranfoxall opened this issue Jul 5, 2022 · 3 comments

Comments

@ranfoxall
Copy link

ranfoxall commented Jul 5, 2022

Hi Stefpeschel,
I've been making a lot of progress comparing networks using NetCoMI based on covariates and am trying to prepare figures showing results from my network analyses. One problem I'm stuck on is how to enable longer node names on the plots from function "netAnalyze". The ASV (or taxa) names are truncated to 6 positions so I have manny duplicate names. When I plot my differential networks (diffnet) I do not run into the same issue, the full ASV name is printed and not truncated to 6 positions. I tried changing the font size but that did not fix the problem.

#network analysis of netConstruct

C0204_netAnalyze<- netAnalyze(C0204_network, 
                           centrLCC = FALSE,
                           avDissIgnoreInf = TRUE,
                           sPathNorm = FALSE,
                           clustMethod = "cluster_fast_greedy",
                           hubPar = c("degree", "between", "closeness"),
                           hubQuant = 0.9,
                           lnormFit = TRUE,
                           normDeg = FALSE,
                           normBetw = FALSE,
                           normClose = FALSE,
                           normEigen = FALSE)
#for plotting
plot(C0204_netAnalyze, 
     sameLayout = TRUE, 
     layoutGroup="union",
     rmSingles="inboth",
     nodeColor = "cluster",
     nodeSize = "mclr",
     labelScale = FALSE,
     cexNodes = 1.5, 
     cexLabels = .5,
     cexHubLabels = 1,
     cexTitle = 1.5,
     groupNames = c("No", "Yes"),
     hubBorderCol  = "gray40")
``
@ranfoxall
Copy link
Author

Untitled

@stefpeschel
Copy link
Owner

Hey @ranfoxall,

Labels can be shortened via the three arguments shortenLabels, labelLength, and labelPattern.

You have three options:

  1. Setting shortenLabels to FALSE does not shorten the labels at all.
  2. Setting shortenLabels to "simple" in combination with labelLength = x cuts the labels after x characters (duplicates may occur).
  3. Setting shortenLabels to "intelligent" in combination with labelLength and labelPattern shortens the labels to a desired length by avoiding duplicates.

Default is shortenLabels = "simple" and labelLength = 6L, which explains the behavior in your case.

Please see the help page (?plot.microNetProps) for further details.

Best,
Stefanie

@ranfoxall
Copy link
Author

Thanks so much Stefanie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants