[BioC] How to use the same node layout for a set of graph plots using graph and Rgraphviz?

Robert Gentleman rgentlem at fhcrc.org
Tue Jan 29 18:21:47 CET 2008

Hi Hugh,
   Sorry to say not easily. And sorry for the long delay in responding, 
I was trying a few things out, but solving this problem seems to require 
a bit of redesign.

   The only thing that might work, in a fairly straightforward fashion 
is, something like this:

   V = letters[1:7];
   M = c(1:3);
   g1 = randomGraph(V,M,.5);
   g2 = randomGraph(V,M,.5);
   g3 = union(g1, g2)

   then layout g3, make a copy of it, set the edge color for g1 edges in 
one copy to the background and for g2 in the other copy.

   You did not say which version of Rgraphviz you are using, but there 
have been a lot of changes to the devel version to make setting node and 
edge attributes for rendering simpler.

   best wishes

Rand, Hugh wrote:
> Hi,
> I am using the packages "graph" and "Rgraphviz". I am using them to display a
>  set of graphs which all have the same nodes, but different edges. To aid in the
>  visual comparison, it would be useful to use the same node layout for all of
>  the graphs. It would be fine to use the node layout from the first graph. It is
>  unclear (to me) how to do this using the layout engine used in Rgraphviz.
> A concrete example:
> library("graph");
> library("Rgraphviz");
> set.seed(123);
> V = letters[1:7];
> M = c(1:3);
> g1 = randomGraph(V,M,.5);
> g2 = randomGraph(V,M,.5);
> par(mfrow=c(1,2));
> plot(g1);
> plot(g2);
> #  The question: How do I now display both g1 and g2 (as seperate plots),
> #    but with the nodes in the same place? I would be content with the node
> #    locations taken from the layout for g1.
> Thanks,
> Hugh Rand
> rand at amgen.com
> 	[[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

Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
rgentlem at fhcrc.org

More information about the Bioconductor mailing list