Dear Bioconductor developers,
I'm using Rgraphviz packages for plotting graphs.
I would like to know if I can label nodes with information that can be
displayed on more lines. Something like:
------------
| info1 |
| info2 |
| info3 |
------------
I looked at the drawTxtLabel() function and I try to give as label for
the node:
nodeLabel = 'info1 \n info2 \n info3'
but it didn't work.
Can somebody tell me if he managed to plot such labels, and if is
possible some small code will be nice.
Many thanks,
Adrian
--
Adrian Alexa
Max-Planck-Institut fuer Informatik
Stuhlsatzenhausweg 85 Room 514
66123 Saarbruecken, Germany
Hi Adrian,
1. Have you tried escaping the \n multiple times, e.g. \\n, \\\\n?
Without understanding the details, sometimes this works.
2. You could use the "text" command, e.g.
nag = agopen( IMCAGraph, name="nag",
attrs= list(node=list(color="white",
fontcolor="white"),
edge=list(arrowsize=2.8, minlen=3)))
nagxy = getNodeXY( nag )
plot( nag )
text( nagxy, label=nodes(IMCAGraph), cex=.8)
with that your approach of including \n should work.
This code example is due to Vince Carey.
A potential problem may be that the arrows might overlap with the
labels.
3. As an alternative, consider the imageMap function in Rgraphviz,
with
which you can associate tooltips and hyperlinks to (bitmap versions
of)
your graph visualizations.
Best wishes
Wolfgang
Adrian Alexa wrote:
> Dear Bioconductor developers,
>
>
> I'm using Rgraphviz packages for plotting graphs.
>
> I would like to know if I can label nodes with information that can
be
> displayed on more lines. Something like:
>
> ------------
> | info1 |
> | info2 |
> | info3 |
> ------------
>
>
> I looked at the drawTxtLabel() function and I try to give as label
for
> the node:
>
> nodeLabel = 'info1 \n info2 \n info3'
>
> but it didn't work.
>
> Can somebody tell me if he managed to plot such labels, and if is
> possible some small code will be nice.
>
>
>
> Many thanks,
>
> Adrian
>
>
--
Best wishes
Wolfgang
-------------------------------------
Wolfgang Huber
European Bioinformatics Institute
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Cambridge CB10 1SD
England
Phone: +44 1223 494642
Http: www.dkfz.de/abt0840/whuber
Sean Davis wrote:
> Wolfgang,
>
> Thanks for the example code. Could I impose on you to expound a bit
on
> (3)?
>
Have you seen the manual page for imageMap in package Rgraphviz?
Let me know if it leaves any open questions.
--
Best wishes
Wolfgang
-------------------------------------
Wolfgang Huber
European Bioinformatics Institute
European Molecular Biology Laboratory
Wellcome Trust Genome Campus
Cambridge CB10 1SD
England
Phone: +44 1223 494642
Http: www.dkfz.de/abt0840/whuber