On Wed, Mar 19, 2014 at 5:47 PM, Augusto Ribas <[email protected]> wrote:

> Hello.
>
> I'm trying to combine 2 plots, a phylogeny and a network.
> but i'm having a little problem.
>
> I would like use the plot method of igraph as an add to another plot with
> (add=T).
> The igraph plot function centralize the coordinates in and limits the plot
> between 1 and -1, both for x and y axis, as seen in figure 2 in the code
> bellow, how do i disable this feature, for example, when i create the
> matrix posicao with the positions that i desire for the vertices(nodes),
> when i say vertice 1 to be at x=1 and y=1, it really be there, and not be
> recalculated to stay between -1 and 1.
>

[...]
rescale
Logical constant, whether to rescale the coordinates to the
[-1,1]x[-1,1](x[-1,1]) interval. This parameter is not implemented for
tkplot.

Defaults to TRUE, the layout will be rescaled.
[...]

http://igraph.org/r/doc/plot.common.html

Gabor


> So i could extract the positions that i desire for another plot and
> establish the layout the is good for me to add to a existing plot.
> There is a sample code bellow.
>
> Well that is it. Thanks for the attention everyone and congratulations on
> this amazing package for graphs.
>
>
>
>
> Sample code
>
> #packages
> library(ape)
> library(igraph)
>
>
> #generate some data
> set.seed(15)
> pol.s<-paste("Polinizador",1:5)
> flor.s<-paste("Flor",1:5)
> dados<-data.frame(pol=sample(pol.s,15,replace=T),flor=
> sample(flor.s,15,replace=T))
>
> dados.g <-graph.data.frame(unique(dados), directed=F)
>
> #position matrix, each line is the position of a vertice(node)
> posicao<-matrix(c(rep(1:2,each=5),rep(1:5,2)),ncol=2,nrow=10)
>
>
> #Figure 1
> plot(rtree(5),show.tip.label=F,use.edge.length = F,edge.width = 2)
> axis(1)
> axis(2)
>
> #figure 2
> plot(dados.g, layout=posicao+1,vertex.color=rep(c("green","yellow"),each=
> 5),
> vertex.shape=rep(c("square","circle"),each=5),vertex.size=35,
> vertex.label=c(paste("Pol",1:5),paste("Flor",1:5)),edge.color="black",
> edge.width=3)
> axis(1)
> axis(2)
>
>
> #figure 3
> #i would like to glues these two guys, but i need to better control the
> arguments
> #and i dont know how :(
> plot(rtree(5),show.tip.label=F,use.edge.length = F,edge.width = 2)
> par(new=T)
> plot(dados.g, layout=posicao,vertex.color=rep(c("green","yellow"),each=5),
> vertex.shape=rep(c("square","circle"),each=5),vertex.size=35,
> vertex.label=c(paste("Pol",1:5),paste("Flor",1:5)),edge.color="black",
> edge.width=3,add=T)
>
>
> --
> Grato
> Augusto C. A. Ribas
>
> Site Pessoal: http://recologia.com.br/ <http://augustoribas.heliohost.org>
> Github: https://github.com/Squiercg
> Lattes: http://lattes.cnpq.br/7355685961127056
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to