Rgraphviz: flexible node sizes
1
0
Entering edit mode
Quin Wills ▴ 80
@quin-wills-4156
Last seen 10.3 years ago
Hi As a long-term R/BIOC user, I still find Rgraphviz quite a challenge. Could somebody please help me with a workflow to allow nodes that adjust to label sizes. This won't work for me: gr <- new("graphAM", cor.object) nodeRenderInfo(gr) <- list(fixedsize=FALSE) gr <- layoutGraph(gr) renderGraph(gr) My R and packages are up to date. I'm Ubuntu 8.04 LTS Thanks [[alternative HTML version deleted]]
Rgraphviz Rgraphviz • 2.0k views
ADD COMMENT
0
Entering edit mode
Quin Wills ▴ 80
@quin-wills-4156
Last seen 10.3 years ago
Anybody? On 6 July 2010 23:21, Quin Wills <qilin@quinwills.net> wrote: > Hi > > As a long-term R/BIOC user, I still find Rgraphviz quite a challenge. > Could somebody please help me with a workflow to allow nodes that adjust to > label sizes. This won't work for me: > > gr <- new("graphAM", cor.object) > nodeRenderInfo(gr) <- list(fixedsize=FALSE) > gr <- layoutGraph(gr) > renderGraph(gr) > > My R and packages are up to date. I'm Ubuntu 8.04 LTS > > Thanks > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
This is my usual workflow, but should work with any graphNEL object. The code looks complex because my node labels sometimes have new line characters "\n". The function basically takes the fontscale (12) and scales fontsizes down to take into the longest label. Hope this helps. g <- new("graphNEL", nodes = myNodes, edgeL = myEdges, edgemode="directed") names(labels) = labels = nodes(g) fixedsize = rep(FALSE, times=length(nodes(g)) fontscale = 12 fontsize = fontscale * max(nchar(unlist(strsplit(labels,"\n", fixed=TRUE)))) / sapply(labels, function(x) { max(nchar(unlist(strsplit(x,"\n", fixed=TRUE)))) }) fontsize[is.infinite(fontsize)] = fontscale names(fill) = names(shape) = names(fontsize) = names(width) = names(height) = nodes(g) Note: fill, shape, width & height are all vectors which I set to get custom node shapes, sizes, and fill color. g <- layoutGraph(g, layoutType = "dot") nodeRenderInfo(g) = list(label = labels, shape = shape, fontsize = fontsize, height = height, lWidth = width/2, rWidth = width/2, fill = fill) g <- renderGraph(g) Cheers, Fraser -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Quin Wills Sent: Thursday, July 08, 2010 8:44 PM To: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Rgraphviz: flexible node sizes Anybody? On 6 July 2010 23:21, Quin Wills <qilin at="" quinwills.net=""> wrote: > Hi > > As a long-term R/BIOC user, I still find Rgraphviz quite a challenge. > Could somebody please help me with a workflow to allow nodes that adjust to > label sizes. This won't work for me: > > gr <- new("graphAM", cor.object) > nodeRenderInfo(gr) <- list(fixedsize=FALSE) > gr <- layoutGraph(gr) > renderGraph(gr) > > My R and packages are up to date. I'm Ubuntu 8.04 LTS > > Thanks > [[alternative HTML version deleted]] _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY

Login before adding your answer.

Traffic: 556 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6