[BioC] Rgraphviz fontsize

Vincent Carey 525-2265 stvjc at channing.harvard.edu
Tue Sep 9 06:25:05 CEST 2008


> Vince,
>
> thanks for the tip.
> Unfortunately I'm not sure how to apply it.
> The vignette doesn't really make clear to me what it is that pwayRendAttrs
> does. It is mentioned once,
> but I'm not exactly clear on its function.
> It also does not seem to apply to the objects of type that I am using: in my
> code I have taken my graphNEL object and
> turned it into an Ragraph object.
>
> Am I, as usual, missing something obvious?

I don't think so.  It seems to be hard to alter the font size much,
in the presence of other constraints on node format such as height and
width.  pwayRendAttrs is used in plotExGraph in pathRender, and one
can get some control over node text font size by passing a modified pwayRendAttrs
(with altered default AllFontsize) as the attgen parameter to plotExGraph --
not a very elegant arrangement, but one can show that the font sizes can be
_reduced_ by doing this.

if we do

library(graph)
library(Rgraphviz)
example(randomGraph)
plot(g1, nodeAttrs=makeNodeAttrs(g1, fontsize=4))
plot(g1, nodeAttrs=makeNodeAttrs(g1, fontsize=4, fillcolor="green"))

we can see that the plotter will respond to the color attribute but
not to the fontsize attribute, despite the fact that fontsize is
identified in GraphvizAttributes as a target Node Attribute.  so
either graphviz is misbehaving with respect to font size control or some
aspect of communication from R to graphviz needs to be corrected.

The fact that you are working with an Ragraph seems to make things
a little harder.  What I see is that the rendering for Ragraph instances
uses drawAgNode which calls drawTxtLabel, and neither seem to make
any use of fontsize specs.

I used fixInNamespace(drawTxtLabel, "Rgraphviz") to place a cex=2
setting on the text() call that concludes that function, and then
plot(agGO) [based on your code] renders the node names quite legibly,
but with some collisions.  you may be able to tweak the cex setting
to get what you want.

there is clearly room for improvement in the Rgraphviz interface ...
I see some work in the graph package on a renderInfo class that may
help with this.  Note you can always use getNodeXY, text, and lines
(on the BezierCurve objects in the AgEdge) to plot an Ragraph with a
desired layout and pretty substantial control over appearance through
basic R graphical primitives.  A rough sketch is

XY = getNodeXY(agGO)
plot(XY, bty="n", xlab=" ", ylab=" ", pch= " ", axes=FALSE)
text(XY, labels=sapply(agGO at AgNode, "name"), cex=.65)
tmp = sapply(AgEdge(agGO), function(x) sapply(x at splines, lines))


>
> Dan.
>
>
>
> On Mon, Sep 8, 2008 at 7:05 PM, Vincent Carey 525-2265 <
> stvjc at channing.harvard.edu> wrote:
>
> > > Hi all,
> > >
> > > I'm attempting to use Rgraphviz to do some plotting.
> > > There is no problem in producing the plots, but I would like to modify
> > font
> > > sizes in the resulting graph, and this appears tricky.
> > > The simple fontsize setting in makeNodeAttrs seems to have no effect.
> >
> > there is a function called pwayRendAttrs in the pathRender
> > package that manipulates graphviz fontsize; plotExG vignette illustrates
> > its use
> >
>
>
>
> --
> Daniel C. Jupiter, Ph.D.
> Postdoctoral Research Associate
> Department of Systems Biology and Translational Medicine
> College of Medicine
> Texas A&M Health Science Center
> 702 SW H.K. Dodgen Loop
> Temple, TX 76504
>
> 979.997.2106 | Fax 254.742.7145
> djupiter at tamu.edu | www.tamhsc.edu
>
> 	[[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
>



More information about the Bioconductor mailing list