How to use the same node layout for a set of graph plots using graph and Rgraphviz?
1
0
Entering edit mode
Rand, Hugh ▴ 50
@rand-hugh-2609
Last seen 9.7 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20080122/ 59e9238c/attachment.pl
• 804 views
ADD COMMENT
0
Entering edit mode
rgentleman ★ 5.5k
@rgentleman-7725
Last seen 9.0 years ago
United States
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: set.seed(123); 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 Robert 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 206-667-7700 rgentlem at fhcrc.org
ADD COMMENT
0
Entering edit mode
Hi Robert, Thanks for the work-around. I will post an example when I get a nice example sorted out. Sorry about not running sessionInfo to provide version info. Hugh -----Original Message----- From: Robert Gentleman [mailto:rgentlem@fhcrc.org] Sent: Tuesday, January 29, 2008 9:22 AM To: Rand, Hugh Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] How to use the same node layout for a set of graph plots using graph and Rgraphviz? 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: set.seed(123); 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 Robert 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 206-667-7700 rgentlem at fhcrc.org
ADD REPLY

Login before adding your answer.

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