Question: Custom node sizes with nodeRenderInfo not work
0
gravatar for heyi xiao
7.0 years ago by
heyi xiao360
United States
heyi xiao360 wrote:
Dear list, I am using the Rgraphviz new interface (layoutGraph + renderGraph) to plot graphs. I want Custom node sizes with nodeRenderInfo, it simply does not work. Has anybody get through this problem? Any suggestions/ideas will be appreciated. #Note: labels, shapes, widths & heights are all vectors of the length. For shapes, I used either box, reactangle, or ellipse. #also tried lWidth = widths/2 and rWidth = widths/2 in place of Width = widths, same thing nAttr<-list(label = labels, shape = shapes, height = heights, Width = widths) nAttr<- lapply(nAttr, function(x) { names(x) <- nNames x}) nodeRenderInfo(g) <- nAttr g <- layoutGraph(g) g <- renderGraph(g)
rgraphviz • 846 views
ADD COMMENTlink modified 7.0 years ago by florian.hahne@novartis.com1.6k • written 7.0 years ago by heyi xiao360
Answer: Custom node sizes with nodeRenderInfo not work
0
gravatar for florian.hahne@novartis.com
7.0 years ago by
Switzerland
The parameters controlling the node width and height are called iwidth and iheight. You will have to set those before you do the layout: g <- randomGraph(V, M, 0.5) nodeRenderInfo(g) <- list(iwidth=list(a=0.2, d=1.5)) g <- layoutGraph(g) g <- renderGraph(g) iwidth and iheight control the size of the rectangular bounding box around a node, so for symmetry you may want to change both (circles as node shapes are forced to be symmetric, but boxes or ellipses are not. Also there is an interaction between the node label size and the node size, and I think you may have to explicitly set the font size for the node text to make this work. Hope that helps, Florian -- On 11/4/12 6:55 PM, "heyi xiao" <xiaoheyiyh at="" yahoo.com=""> wrote: >Dear list, >I am using the Rgraphviz new interface (layoutGraph + renderGraph) to >plot graphs. I want Custom node sizes with nodeRenderInfo, it simply does >not work. Has anybody get through this problem? Any suggestions/ideas >will be appreciated. > >#Note: labels, shapes, widths & heights are all vectors of the length. >For shapes, I used either box, reactangle, or ellipse. >#also tried lWidth = widths/2 and rWidth = widths/2 in place of Width = >widths, same thing >nAttr<-list(label = labels, shape = shapes, height = heights, Width = >widths) >nAttr<- lapply(nAttr, function(x) { >names(x) <- nNames >x}) >nodeRenderInfo(g) <- nAttr >g <- layoutGraph(g) >g <- renderGraph(g) >
ADD COMMENTlink written 7.0 years ago by florian.hahne@novartis.com1.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 305 users visited in the last hour