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)
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)
>