stefpeschel / NetCoMi

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

Change edge width range #101

Closed danpal96 closed 10 months ago

danpal96 commented 11 months ago

I suppose that the edge width is scaled by the edge weight, is there a way to define this range?

stefpeschel commented 11 months ago

Yes, the edge width is in principle scaled by edge weight. However, the plot function has a few arguments influencing the edge widths: edgeWidth, cut, edgeTranspLow, edgeTranspHigh. Please see the help page for details. You can read out the current cut value and change it to lower or higher values to increase or decrease the set of "unimportant" edges. Here's a brief example:

p <- plot(netprops)
p$q1$Arguments$cut
plot(netprops, cut = 0.1)

q1 is the output of the qgraph function used for network plotting (q2 belongs to the second network if existent).

qgraph also has a further argument esize that could be interesting for you. It defines the maximum edge width. Since NetCoMi's plot function also accepts qgraph arguments, you can just pass it to the plot function.

danpal96 commented 10 months ago

esize is useful for what I wanted to do but my main problem is that the negative edges with dissFunc = "signed" are barely visible, I couldn't find a way to set a minimum edge width so for now I just scaled the adjacency matrix

sel_props <- copy(props_pears)
sel_props$input$adjaMat1 <- apply(sel_props$input$adjaMat1, c(1,2), function(x)  if (x == 0) x else x / 2 + 0.5)