Question: Rgraphviz edge attributes can't be changed on Mac
gravatar for Luo Weijun
12.0 years ago by
Luo Weijun1.5k
United States
Luo Weijun1.5k wrote:
Thanks, Herve, I updated R , BioConductor and Rgraphviz to the latest versions. I still can't customize the edge attributes as I mentioned earlier. Any ideas? Weijun And this is my current session information. > sessionInfo() R version 2.6.0 (2007-10-03) powerpc-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] Rgraphviz_1.16.0 graph_1.16.1 XML_1.93-2 loaded via a namespace (and not attached): [1] cluster_1.11.9 rcompgen_0.1-15 tools_2.6.0 --- Herve Pages <hpages at=""""> wrote: > Hi Luo, > > Please update your R + Bioconductor installation to > the current > release (R 2.6.0 and BioC 2.1) and see if this > solves your problem. > Past releases of BioC are not supported. > FYI the current release version of Rgraphviz is > 1.16.0 and that's the > version you should get if you use biocLite() from R > 2.6.0: > > > > Thanks! > H. > > > Luo Weijun wrote: > > Hello everybody, > > > > I used Rgraphviz to plot some signaling pathway. > It > > did work well in many aspects, including node > > attributes. However, when I tried to customize the > > edge attributes, it did really work. I can't > change > > any of these attributes, including arrowhead, > style > > (e.g. line style, dashed, solid etc), > labelfontsize. I > > did see the edge labels but their size was too big > and > > I couldn't change it. I doubt other attributes > would > > all work well. I noticed that other people > reported > > something similar on Mac early this year in a > thread > > titled "Rgraphviz: Edge attributes not > displaying", > > but they couldn't even see the labels. I would > > appreciate it much if anybody can give me a little > > help on this. Thank you! > > Weijun > > > > These is the codes I used to layout and plot the > > graph: > > > > tgf=agopen(kg1, name='kg', attrs = attrs, > > nodeAttrs=nAttr, edgeAttrs=eAttr, > subGList=subGList) > > loc=getNodeXY(tgf) > > pdf('kg.pdf') > > plot(tgf) > > text(loc, label = labType[1,ni], cex = 0.4) > > > > > > Not that I have to use agopen, because I need to > > retrieve locations of the nodes and add other > things > > after plot(). I tried toFile() function to output > as > > PS file, didn't work at all (I can't even open the > > file). Actually toFile doesn't allow me add > anything > > later even if it works. > > > > My operating system is Mac OS X 10.4.9, and this > is my > > session information > > > >> sessionInfo() > > R version 2.5.1 (2007-06-27) > > powerpc-apple-darwin8.9.1 > > > > locale: > > C > > > > attached base packages: > > [1] "tools" "stats" "graphics" > "grDevices" > > "utils" "datasets" > > [7] "methods" "base" > > > > other attached packages: > > Rgraphviz geneplotter lattice annotate > > > Biobase graph > > "1.14.1" "1.14.0" "0.15-11" "1.14.1" > > "1.14.0" "1.14.2" > > XML > > "1.9-0" > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor at > > > > Search the archives: > > >
biobase geneplotter rgraphviz • 557 views
ADD COMMENTlink modified 12.0 years ago by Florian Hahne540 • written 12.0 years ago by Luo Weijun1.5k
Answer: Rgraphviz edge attributes can't be changed on Mac
gravatar for
12.0 years ago by
Li.Long@isb-sib.ch510 wrote:
> Thanks, Herve, > I updated R , BioConductor and Rgraphviz to the latest > versions. I still can't customize the edge attributes > as I mentioned earlier. Any ideas? > Weijun Hi, Since you use "agopen" to prepare the graph for layout and rendering, the attributes (for both nodes/edges) you could are limited, you can use "getDefaultAttr" to see which are honored. This is probably changing un the near future. To use "toFile", you could take a look at "agopenSimple" and various functions that go with it to set all sorts of attributes graphviz supports. There's a section in the Rgraphviz vignette (near the end of it) that shows the work flow. I don't think the problem you encounter has much to do with Mac OS. Li
ADD COMMENTlink written 12.0 years ago by Li.Long@isb-sib.ch510
Answer: Rgraphviz edge attributes can't be changed on Mac
gravatar for Florian Hahne
12.0 years ago by
Florian Hahne540
Florian Hahne540 wrote:
Hi Weijun, we are currently working on a more generalized API for rendering of graphs. The idea here is to have all necesary rendering information as part of the graph object, and also not to be so tightly linked to the graphviz library, there are other layout engines around. In the latest devel version of Rgraphviz there is a function layoutGraph which will create the necessary layout information for a graph and the function renderGraph which will plot a laid out graph. So the workflow is somehow similar to what we have at the moment with agopen/plot. The rendering parameters (color, line width, etc.) are separated from the layout parameters and can be changed on a graph without the need for redoing the layout. You can set and retrieve these parameters on the graph object using the nodeRenderInfo, edgeRenderInfo and graphRenderInfo functions. Also, you can set defaults using the graph.par function. Layout parameters (node shapes, layout type, etc.) can still be passed to the layout algorithm in the ususal fassion (edgeAttr, nodeAttr, ...). Here's a little example: library(graph) library(Rgraphviz) set.seed(123) V <- letters[1:10] M <- 1:4 g1 <- randomGraph(V, M, 0.8) edgemode(g1) <- "directed" x <- layoutGraph(g1) x <- renderGraph(x) ## change some of the node rendering parameters nodeRenderInfo(x) <- list(fill=c(a="red", b="blue"), textCol=c(e="orange")) x <- renderGraph(x) ## and some of the edge rendering parameters edgeRenderInfo(x) <- list(lwd=c("g~i"=3, "d~j"=5), lty=c("d~j"="dotted")) x <- renderGraph(x) ## add some edge labels labs <- edgeNames(x) names(labs) <- labs edgeRenderInfo(x) <- list(label=labs, fontsize=c("g~i"=20), textCol=c("g~i"="green")) x <- layoutGraph(x) x <- renderGraph(x) ## title and subtitle graphRenderInfo(x) <- list(main="An example graph", sub="showing the new rendering capabilities") x <- renderGraph(x) ## now set some defaults graph.par(list(edges=list(fontsize=16, textCol="gray"), graph=list("cex.main"=4))) x <- renderGraph(x) Note that this is all under heavy development and you need both the latest Rgraphviz (1.17.11) and graph (1.17.10 ) versions from the devel branch (best is to compile directly form the svn repository). Also the documentation is still lacking behind a bit, but among too many other things I am working on that. It would be really helpful if you could try this out and tell me which of the things you want to do are not working yet. You can still get to the node locations if you want to add your own stuff by nodeRenderInfo(x, c("nodeX", "nodeY")) but these coordinates might not be too helpful as they are because they are only valid within renderGraph's environment. You can emulate that doing something like this: par(mai=graphRenderInfo(x, "mai"), usr=graphRenderInfo(x, "usr")) Cheers, Florian
ADD COMMENTlink written 12.0 years ago by Florian Hahne540
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 240 users visited in the last hour