despite relative popularity of neighbornets, couldn't find solutions following problem. in r, i'm trying plot neighbornet (created using package phangorn, object class networx). package uses igraph plotting static 2d graphs, every time re-plot graph, layout changes/rotates (default behaviour of igraph, apparently). now, if plot usual igraph, i'd save layout, , keep re-using it:
fixed = layout.sphere(somegraph) plot(somegraph, layout=fixed) but doesn't work current problem. file of plot.networx refer igraph , layout, in 'see also' section. creating x-y coordinate matrix manually wouldn't work (as suggested here), location of node labels/tips of nodes significant on neighbornet. tried
library("phangorn") library("igraph") mydist = dist(matrix(sample(100), ncol=10)) # example data nnet = neighbornet(mydist) fixed = layout.sphere(nnet) # error, not graph object fixed = layout.sphere(as.igraph(nnet)) # doesn't work properly, mangled graph so question, how working in vein of
plot.networx(nnet, type="2d", layout = fixed) # ?
plot.networx calls phangorn:::coords coords (for 2d) creates igraph object , uses layout.kamada.kawai. hard-coded plot.networx not flexible enough such use layout algorithm.
you follow code in phangorn:::coords create graph layout , replace layout function one, , call phangorn:::plot2d coords. see plot.networx see how call phangorn:::plot2d correctly.
Comments
Post a Comment