Custom node sizes with nodeRenderInfo not work
1
0
Entering edit mode
heyi xiao ▴ 360
@heyi-xiao-3308
Last seen 7.7 years ago
United States
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 Rgraphviz • 1.5k views
ADD COMMENT
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 5.8 years ago
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 COMMENT

Login before adding your answer.

Traffic: 1510 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