Re: [R-sig-phylo] Graphically comparing multiple trees
Hi Vojtěch, On Wed, Apr 26, 2017 at 1:09 PM, Vojtěch Zeisek wrote: > Hi, > thank You for the advice. I tried: > densiTree(x=hirta, type="phylogram", scaleX=TRUE, width=2, > col=rainbow(length(hirta)), font=3, underscore=FALSE) > looks relatively nicely. I just wonder why last 2 options have no effect > (i.e. > I wish tip labels in italics and without underscore). you are right the last 2 options have no effect, at least in the CRAN version, I added them and a few more on the in the development version on github: devtools::install_github("KlausVigo/phangorn") > I also didn't find how > to add little vertical offset among trees to show identical lines in > parallel. > I thought this would be your little homework, but Liam spoiled it ;) and did all the work for you. The densiTree function is just about 40 lines, so it would be easy just add some offset, etc. and I always look forward to pull requests. Cheers, Klaus > Without it, the display is very messy and unreadable... :-( > Sincerely, > V. > > Dne úterý 25. dubna 2017 23:04:01 CEST jste napsal(a): > > Hi Vojtěch, > > you could try adopt densiTree() in phangorn to do this. It just plots > each > > tree separate over each other. You probably want to of move each tree a > bit > > up or down and add some more control for colors. It is based on the > > internal function of from plot.phylo(). > > Cheers, > > Klaus > > > > On Tue, Apr 25, 2017 at 2:25 PM, Liam J. Revell > wrote: > > > Hi Vojtěch. > > > > > > This kind of plot is possible to make using plotTree in phytools via > the > > > arguments tips (which sets the vertical coordinates of the tips, > > > regardless > > > of topology) & add (a logical value indicating whether to add the tree > > > tree > > > to an existing plot or to open a new plot). (All arguments for plotTree > > > are > > > documented in the man page for plotSimmap which plotTree uses > internally.) > > > Unfortunately, there is some complication. For instance, unless we set > > > xlim > > > & ylim, then plotTree will reset these values for each new plotted > tree. > > > > > > Later this evening I will do my best to make an example & post it to my > > > blog. > > > > > > - Liam > > > > > > On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > > >> Hello, > > >> for comparison of two trees I can use very nice function cophyloplot > > >> plotting > > >> two trees (left and right) and connecting respective nodes by lines. > Very > > >> nice > > >> and convenient to read. But only for two trees. Displaying multiple > trees > > >> in multiple comparisons is not very convenient. > > >> To display dozens to hundreds of trees there is densitree. Also nice, > but > > >> for this purpose I don't like its display. > > >> I have several trees (~5) and I wish to compare their topologies, show > > >> supports (at least for differing nodes) and highlight differences. I > > >> thought > > >> about some overlay/parallel plotting (similar to the attached image) > > >> where > > >> there would be complete topologies displayed and incongruences would > be > > >> easily > > >> visible. It would be probably doable by plotting all separate trees by > > >> plot.phylo and then combining and tuning the figure in some vector > editor > > >> (like Inkscape). But I hope there is some more automated way to do it. > > >> :-) > > >> Sincerely, > > >> V. > -- > Vojtěch Zeisek > https://trapa.cz/en/ > > Department of Botany, Faculty of Science > Charles University, Prague, Czech Republic > https://www.natur.cuni.cz/biology/botany/ > > Institute of Botany, Czech Academy of Sciences > Průhonice, Czech Republic > http://www.ibot.cas.cz/en/ > > ___ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > -- Klaus Schliep Postdoctoral Fellow Revell Lab, University of Massachusetts Boston http://www.phangorn.org/ [[alternative HTML version deleted]] ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Thank You! densityTree(trees, use.gradient=TRUE, fix.depth=TRUE, alpha=0.5, lwd=4) is really nice. Could You finally point me how to add supports (nodelabels) for each tree in its respective color? Sincerely, V. Dne středa 26. dubna 2017 22:10:27 CEST, Liam J. Revell napsal(a): > I have now incorporated all of these methods into the phytools function > densityTree which I have also completely re-written. More information > can be seen on my blog here: > http://blog.phytools.org/2017/04/complete-re-write-of-phytools.html. > > The function is already in phytools which can be installed from GitHub > using devtools. > > - Liam > > On 4/26/2017 12:18 PM, Vojtěch Zeisek wrote: > > Yes, it helps and makes the tree in good scale. Just branches of one tree > > do not reach the right edge like the others. And tip labels are still > > missing. V. > > > > Dne středa 26. dubna 2017 18:52:04 CEST jste napsal(a): > >> Oops. ylim should be c(0,Ntip(trees[[1]])) rather than c(0,11) (that was > >> specific to the 10 taxon case. Let me know if that helps. > >> > >> On 4/26/2017 11:48 AM, Vojtěch Zeisek wrote: > >>> Hello, > >>> Liam, thank You very much! It is what I was looking for. Unfortunately, > >>> I > >>> have problem with Your solution 4 and onward (attached). Previous 3 > >>> solutions worked as expected. Some trees were unrooted, rooting did not > >>> help. Branch lengths were variable, but all were ultrametric. Also I > >>> don't see why tip labels are missing. > >>> I'd also add one more information. Incongruent nodes use to have low > >>> support among trees. I'd like to display support below e.g. 90 in color > >>> of respective tree and some offset not to overlap. > >>> print.phylo(x=hirta[[1]], details=TRUE) # Other trees are similar... > >>> Phylogenetic tree with 28 tips and 27 internal nodes. > >>> Tip labels: > >>> O._engleriana, O._odorata, O._versicolor, O._zeyheri, O._fibrosa, > >>> O._ciliaris, ... > >>> Node labels: > >>> , NA, 100.0, 100.0, 99.0, 100.0, ... > >>> Rooted; includes branch lengths. > >>> ## What I did: > >>> # Vertical offset > >>> hirta.ylim <- c(0, Ntip(hirta[[1]])+1) > >>> # Get depths of the tree > >>> hirta.h <- sapply(hirta, function(x) max(nodeHeights(x))) > >>> # Test plot the longest tree to get the maximum x dimension > >>> plotTree(hirta[[which(hirta.h==max(hirta.h))]], direction="leftwards") > >>> hirta.xlim <- get("last_plot.phylo", envir=.PlotPhyloEnv)$x.lim > >>> # Set tip order based on a majority rule consensus tree > >>> hirta.tips <- setNames(1:Ntip(hirta[[1]]), untangle(consensus(hirta, > >>> p=0.5), "read.tree")$tip.label) > >>> # Set colors > >>> hirta.colors <- rainbow(n=length(hirta)) > >>> # Plot our trees > >>> for(i in 1:length(hirta)) { > >>> hirta.y.shift <- (i-median(1:length(hirta)))/length(hirta)/2 > >>> plotTree(hirta[[i]], color=make.transparent(hirta.colors[i], 0.4), > >>> tips=hirta.tips+hirta.y.shift, add=i>1, direction="leftwards", > >>> xlim=hirta.xlim[2:1], mar=c(4.1, 1.1, 1.1, 1.1), nodes="inner", > >>> ftype=if(i==median(1:length(hirta))) "i" else "off", ylim=c(0, 11)) > >>> if(i==1) axis(1) > >>> } > >>> Sincerely, > >>> V. > >>> > >>> Dne středa 26. dubna 2017 15:29:45 CEST jste napsal(a): > Hi Vojtech. > > I just posted a handful of different possible solutions using phytools > on my blog: > http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let > me know if any of them work for you. > > All the best, Liam > > On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > > Hello, > > for comparison of two trees I can use very nice function cophyloplot > > plotting two trees (left and right) and connecting respective nodes by > > lines. Very nice and convenient to read. But only for two trees. > > Displaying multiple trees in multiple comparisons is not very > > convenient. > > To display dozens to hundreds of trees there is densitree. Also nice, > > but > > for this purpose I don't like its display. > > I have several trees (~5) and I wish to compare their topologies, show > > supports (at least for differing nodes) and highlight differences. I > > thought about some overlay/parallel plotting (similar to the attached > > image) where there would be complete topologies displayed and > > incongruences would be easily visible. It would be probably doable by > > plotting all separate trees by plot.phylo and then combining and > > tuning > > the figure in some vector editor (like Inkscape). But I hope there is > > some more automated way to do it. :-) Sincerely, > > V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part
Re: [R-sig-phylo] Graphically comparing multiple trees
I have now incorporated all of these methods into the phytools function densityTree which I have also completely re-written. More information can be seen on my blog here: http://blog.phytools.org/2017/04/complete-re-write-of-phytools.html. The function is already in phytools which can be installed from GitHub using devtools. - Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 4/26/2017 12:18 PM, Vojtěch Zeisek wrote: Yes, it helps and makes the tree in good scale. Just branches of one tree do not reach the right edge like the others. And tip labels are still missing. V. Dne středa 26. dubna 2017 18:52:04 CEST jste napsal(a): Oops. ylim should be c(0,Ntip(trees[[1]])) rather than c(0,11) (that was specific to the 10 taxon case. Let me know if that helps. On 4/26/2017 11:48 AM, Vojtěch Zeisek wrote: Hello, Liam, thank You very much! It is what I was looking for. Unfortunately, I have problem with Your solution 4 and onward (attached). Previous 3 solutions worked as expected. Some trees were unrooted, rooting did not help. Branch lengths were variable, but all were ultrametric. Also I don't see why tip labels are missing. I'd also add one more information. Incongruent nodes use to have low support among trees. I'd like to display support below e.g. 90 in color of respective tree and some offset not to overlap. print.phylo(x=hirta[[1]], details=TRUE) # Other trees are similar... Phylogenetic tree with 28 tips and 27 internal nodes. Tip labels: O._engleriana, O._odorata, O._versicolor, O._zeyheri, O._fibrosa, O._ciliaris, ... Node labels: , NA, 100.0, 100.0, 99.0, 100.0, ... Rooted; includes branch lengths. ## What I did: # Vertical offset hirta.ylim <- c(0, Ntip(hirta[[1]])+1) # Get depths of the tree hirta.h <- sapply(hirta, function(x) max(nodeHeights(x))) # Test plot the longest tree to get the maximum x dimension plotTree(hirta[[which(hirta.h==max(hirta.h))]], direction="leftwards") hirta.xlim <- get("last_plot.phylo", envir=.PlotPhyloEnv)$x.lim # Set tip order based on a majority rule consensus tree hirta.tips <- setNames(1:Ntip(hirta[[1]]), untangle(consensus(hirta, p=0.5), "read.tree")$tip.label) # Set colors hirta.colors <- rainbow(n=length(hirta)) # Plot our trees for(i in 1:length(hirta)) { hirta.y.shift <- (i-median(1:length(hirta)))/length(hirta)/2 plotTree(hirta[[i]], color=make.transparent(hirta.colors[i], 0.4), tips=hirta.tips+hirta.y.shift, add=i>1, direction="leftwards", xlim=hirta.xlim[2:1], mar=c(4.1, 1.1, 1.1, 1.1), nodes="inner", ftype=if(i==median(1:length(hirta))) "i" else "off", ylim=c(0, 11)) if(i==1) axis(1) } Sincerely, V. Dne středa 26. dubna 2017 15:29:45 CEST jste napsal(a): Hi Vojtech. I just posted a handful of different possible solutions using phytools on my blog: http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let me know if any of them work for you. All the best, Liam On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: Hello, for comparison of two trees I can use very nice function cophyloplot plotting two trees (left and right) and connecting respective nodes by lines. Very nice and convenient to read. But only for two trees. Displaying multiple trees in multiple comparisons is not very convenient. To display dozens to hundreds of trees there is densitree. Also nice, but for this purpose I don't like its display. I have several trees (~5) and I wish to compare their topologies, show supports (at least for differing nodes) and highlight differences. I thought about some overlay/parallel plotting (similar to the attached image) where there would be complete topologies displayed and incongruences would be easily visible. It would be probably doable by plotting all separate trees by plot.phylo and then combining and tuning the figure in some vector editor (like Inkscape). But I hope there is some more automated way to do it. :-) Sincerely, V. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi, this looks like really great tool. The chapter about median trees at https:// thibautjombart.github.io/treespace/ is something different from what I need. But I will definitely use it, for little different task. :-) Thank You, V. Dne úterý 25. dubna 2017 19:59:34 CEST jste napsal(a): > Hi there, > > treespace would be an alternative, but its usefulness for 5 trees will > be quite limited. Just in case: > https://github.com/thibautjombart/treescape > > Cheers > Thibaut > > On 25 April 2017 at 18:20, Vojtěch Zeisek wrote: > > Hello, > > for comparison of two trees I can use very nice function cophyloplot > > plotting two trees (left and right) and connecting respective nodes by > > lines. Very nice and convenient to read. But only for two trees. > > Displaying multiple trees in multiple comparisons is not very convenient. > > To display dozens to hundreds of trees there is densitree. Also nice, but > > for this purpose I don't like its display. > > I have several trees (~5) and I wish to compare their topologies, show > > supports (at least for differing nodes) and highlight differences. I > > thought about some overlay/parallel plotting (similar to the attached > > image) where there would be complete topologies displayed and > > incongruences would be easily visible. It would be probably doable by > > plotting all separate trees by plot.phylo and then combining and tuning > > the figure in some vector editor (like Inkscape). But I hope there is > > some more automated way to do it. :-) Sincerely, > > V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Yes, it helps and makes the tree in good scale. Just branches of one tree do not reach the right edge like the others. And tip labels are still missing. V. Dne středa 26. dubna 2017 18:52:04 CEST jste napsal(a): > Oops. ylim should be c(0,Ntip(trees[[1]])) rather than c(0,11) (that was > specific to the 10 taxon case. Let me know if that helps. > > On 4/26/2017 11:48 AM, Vojtěch Zeisek wrote: > > Hello, > > Liam, thank You very much! It is what I was looking for. Unfortunately, I > > have problem with Your solution 4 and onward (attached). Previous 3 > > solutions worked as expected. Some trees were unrooted, rooting did not > > help. Branch lengths were variable, but all were ultrametric. Also I > > don't see why tip labels are missing. > > I'd also add one more information. Incongruent nodes use to have low > > support among trees. I'd like to display support below e.g. 90 in color > > of respective tree and some offset not to overlap. > > > > print.phylo(x=hirta[[1]], details=TRUE) # Other trees are similar... > > > > Phylogenetic tree with 28 tips and 27 internal nodes. > > > > Tip labels: > > O._engleriana, O._odorata, O._versicolor, O._zeyheri, O._fibrosa, > > > > O._ciliaris, ... > > > > Node labels: > > , NA, 100.0, 100.0, 99.0, 100.0, ... > > > > Rooted; includes branch lengths. > > ## What I did: > > # Vertical offset > > hirta.ylim <- c(0, Ntip(hirta[[1]])+1) > > # Get depths of the tree > > hirta.h <- sapply(hirta, function(x) max(nodeHeights(x))) > > # Test plot the longest tree to get the maximum x dimension > > plotTree(hirta[[which(hirta.h==max(hirta.h))]], direction="leftwards") > > hirta.xlim <- get("last_plot.phylo", envir=.PlotPhyloEnv)$x.lim > > # Set tip order based on a majority rule consensus tree > > hirta.tips <- setNames(1:Ntip(hirta[[1]]), untangle(consensus(hirta, > > p=0.5), "read.tree")$tip.label) > > # Set colors > > hirta.colors <- rainbow(n=length(hirta)) > > # Plot our trees > > for(i in 1:length(hirta)) { > > > > hirta.y.shift <- (i-median(1:length(hirta)))/length(hirta)/2 > > plotTree(hirta[[i]], color=make.transparent(hirta.colors[i], 0.4), > > > > tips=hirta.tips+hirta.y.shift, add=i>1, direction="leftwards", > > xlim=hirta.xlim[2:1], mar=c(4.1, 1.1, 1.1, 1.1), nodes="inner", > > ftype=if(i==median(1:length(hirta))) "i" else "off", ylim=c(0, 11)) > > > > if(i==1) axis(1) > > } > > > > Sincerely, > > V. > > > > Dne středa 26. dubna 2017 15:29:45 CEST jste napsal(a): > >> Hi Vojtech. > >> > >> I just posted a handful of different possible solutions using phytools > >> on my blog: > >> http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let > >> me know if any of them work for you. > >> > >> All the best, Liam > >> > >> On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > >>> Hello, > >>> for comparison of two trees I can use very nice function cophyloplot > >>> plotting two trees (left and right) and connecting respective nodes by > >>> lines. Very nice and convenient to read. But only for two trees. > >>> Displaying multiple trees in multiple comparisons is not very > >>> convenient. > >>> To display dozens to hundreds of trees there is densitree. Also nice, > >>> but > >>> for this purpose I don't like its display. > >>> I have several trees (~5) and I wish to compare their topologies, show > >>> supports (at least for differing nodes) and highlight differences. I > >>> thought about some overlay/parallel plotting (similar to the attached > >>> image) where there would be complete topologies displayed and > >>> incongruences would be easily visible. It would be probably doable by > >>> plotting all separate trees by plot.phylo and then combining and tuning > >>> the figure in some vector editor (like Inkscape). But I hope there is > >>> some more automated way to do it. :-) Sincerely, > >>> V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi, thank You for the advice. I tried: densiTree(x=hirta, type="phylogram", scaleX=TRUE, width=2, col=rainbow(length(hirta)), font=3, underscore=FALSE) looks relatively nicely. I just wonder why last 2 options have no effect (i.e. I wish tip labels in italics and without underscore). I also didn't find how to add little vertical offset among trees to show identical lines in parallel. Without it, the display is very messy and unreadable... :-( Sincerely, V. Dne úterý 25. dubna 2017 23:04:01 CEST jste napsal(a): > Hi Vojtěch, > you could try adopt densiTree() in phangorn to do this. It just plots each > tree separate over each other. You probably want to of move each tree a bit > up or down and add some more control for colors. It is based on the > internal function of from plot.phylo(). > Cheers, > Klaus > > On Tue, Apr 25, 2017 at 2:25 PM, Liam J. Revell wrote: > > Hi Vojtěch. > > > > This kind of plot is possible to make using plotTree in phytools via the > > arguments tips (which sets the vertical coordinates of the tips, > > regardless > > of topology) & add (a logical value indicating whether to add the tree > > tree > > to an existing plot or to open a new plot). (All arguments for plotTree > > are > > documented in the man page for plotSimmap which plotTree uses internally.) > > Unfortunately, there is some complication. For instance, unless we set > > xlim > > & ylim, then plotTree will reset these values for each new plotted tree. > > > > Later this evening I will do my best to make an example & post it to my > > blog. > > > > - Liam > > > > On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > >> Hello, > >> for comparison of two trees I can use very nice function cophyloplot > >> plotting > >> two trees (left and right) and connecting respective nodes by lines. Very > >> nice > >> and convenient to read. But only for two trees. Displaying multiple trees > >> in multiple comparisons is not very convenient. > >> To display dozens to hundreds of trees there is densitree. Also nice, but > >> for this purpose I don't like its display. > >> I have several trees (~5) and I wish to compare their topologies, show > >> supports (at least for differing nodes) and highlight differences. I > >> thought > >> about some overlay/parallel plotting (similar to the attached image) > >> where > >> there would be complete topologies displayed and incongruences would be > >> easily > >> visible. It would be probably doable by plotting all separate trees by > >> plot.phylo and then combining and tuning the figure in some vector editor > >> (like Inkscape). But I hope there is some more automated way to do it. > >> :-) > >> Sincerely, > >> V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hello, Liam, thank You very much! It is what I was looking for. Unfortunately, I have problem with Your solution 4 and onward (attached). Previous 3 solutions worked as expected. Some trees were unrooted, rooting did not help. Branch lengths were variable, but all were ultrametric. Also I don't see why tip labels are missing. I'd also add one more information. Incongruent nodes use to have low support among trees. I'd like to display support below e.g. 90 in color of respective tree and some offset not to overlap. print.phylo(x=hirta[[1]], details=TRUE) # Other trees are similar... Phylogenetic tree with 28 tips and 27 internal nodes. Tip labels: O._engleriana, O._odorata, O._versicolor, O._zeyheri, O._fibrosa, O._ciliaris, ... Node labels: , NA, 100.0, 100.0, 99.0, 100.0, ... Rooted; includes branch lengths. ## What I did: # Vertical offset hirta.ylim <- c(0, Ntip(hirta[[1]])+1) # Get depths of the tree hirta.h <- sapply(hirta, function(x) max(nodeHeights(x))) # Test plot the longest tree to get the maximum x dimension plotTree(hirta[[which(hirta.h==max(hirta.h))]], direction="leftwards") hirta.xlim <- get("last_plot.phylo", envir=.PlotPhyloEnv)$x.lim # Set tip order based on a majority rule consensus tree hirta.tips <- setNames(1:Ntip(hirta[[1]]), untangle(consensus(hirta, p=0.5), "read.tree")$tip.label) # Set colors hirta.colors <- rainbow(n=length(hirta)) # Plot our trees for(i in 1:length(hirta)) { hirta.y.shift <- (i-median(1:length(hirta)))/length(hirta)/2 plotTree(hirta[[i]], color=make.transparent(hirta.colors[i], 0.4), tips=hirta.tips+hirta.y.shift, add=i>1, direction="leftwards", xlim=hirta.xlim[2:1], mar=c(4.1, 1.1, 1.1, 1.1), nodes="inner", ftype=if(i==median(1:length(hirta))) "i" else "off", ylim=c(0, 11)) if(i==1) axis(1) } Sincerely, V. Dne středa 26. dubna 2017 15:29:45 CEST jste napsal(a): > Hi Vojtech. > > I just posted a handful of different possible solutions using phytools > on my blog: > http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let > me know if any of them work for you. > > All the best, Liam > > On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > > Hello, > > for comparison of two trees I can use very nice function cophyloplot > > plotting two trees (left and right) and connecting respective nodes by > > lines. Very nice and convenient to read. But only for two trees. > > Displaying multiple trees in multiple comparisons is not very convenient. > > To display dozens to hundreds of trees there is densitree. Also nice, but > > for this purpose I don't like its display. > > I have several trees (~5) and I wish to compare their topologies, show > > supports (at least for differing nodes) and highlight differences. I > > thought about some overlay/parallel plotting (similar to the attached > > image) where there would be complete topologies displayed and > > incongruences would be easily visible. It would be probably doable by > > plotting all separate trees by plot.phylo and then combining and tuning > > the figure in some vector editor (like Inkscape). But I hope there is > > some more automated way to do it. :-) Sincerely, > > V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi Vojtech. I just posted a handful of different possible solutions using phytools on my blog: http://blog.phytools.org/2017/04/showing-multiple-conflicting.html. Let me know if any of them work for you. All the best, Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: Hello, for comparison of two trees I can use very nice function cophyloplot plotting two trees (left and right) and connecting respective nodes by lines. Very nice and convenient to read. But only for two trees. Displaying multiple trees in multiple comparisons is not very convenient. To display dozens to hundreds of trees there is densitree. Also nice, but for this purpose I don't like its display. I have several trees (~5) and I wish to compare their topologies, show supports (at least for differing nodes) and highlight differences. I thought about some overlay/parallel plotting (similar to the attached image) where there would be complete topologies displayed and incongruences would be easily visible. It would be probably doable by plotting all separate trees by plot.phylo and then combining and tuning the figure in some vector editor (like Inkscape). But I hope there is some more automated way to do it. :-) Sincerely, V. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi Dne úterý 25. dubna 2017 19:57:16 CEST jste napsal(a): > a simple solution might be par(new=TRUE): > > library("ape") > > A <- rtree(10) > > B <- rtree(10) > > plot(A) > > par(new=TRUE) > > plot(B,edge.col="blue") Thank You for the hint. This is simple, but it doesn't align the tip labels. I need some optimization to align same labels as close together as possible. I see it like last instance if other options fail. I'll explore rest of the options now. :-) > On Tue, Apr 25, 2017 at 12:20 PM, Vojtěch Zeisek wrote: > > Hello, > > for comparison of two trees I can use very nice function cophyloplot > > plotting > > two trees (left and right) and connecting respective nodes by lines. Very > > nice > > and convenient to read. But only for two trees. Displaying multiple trees > > in > > multiple comparisons is not very convenient. > > To display dozens to hundreds of trees there is densitree. Also nice, but > > for > > this purpose I don't like its display. > > I have several trees (~5) and I wish to compare their topologies, show > > supports (at least for differing nodes) and highlight differences. I > > thought > > about some overlay/parallel plotting (similar to the attached image) where > > there would be complete topologies displayed and incongruences would be > > easily > > visible. It would be probably doable by plotting all separate trees by > > plot.phylo and then combining and tuning the figure in some vector editor > > (like Inkscape). But I hope there is some more automated way to do it. :-) > > Sincerely, > > V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi Vojtěch, you could try adopt densiTree() in phangorn to do this. It just plots each tree separate over each other. You probably want to of move each tree a bit up or down and add some more control for colors. It is based on the internal function of from plot.phylo(). Cheers, Klaus On Tue, Apr 25, 2017 at 2:25 PM, Liam J. Revell wrote: > Hi Vojtěch. > > This kind of plot is possible to make using plotTree in phytools via the > arguments tips (which sets the vertical coordinates of the tips, regardless > of topology) & add (a logical value indicating whether to add the tree tree > to an existing plot or to open a new plot). (All arguments for plotTree are > documented in the man page for plotSimmap which plotTree uses internally.) > Unfortunately, there is some complication. For instance, unless we set xlim > & ylim, then plotTree will reset these values for each new plotted tree. > > Later this evening I will do my best to make an example & post it to my > blog. > > - Liam > > Liam J. Revell, Associate Professor of Biology > University of Massachusetts Boston > web: http://faculty.umb.edu/liam.revell/ > email: liam.rev...@umb.edu > blog: http://blog.phytools.org > > On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: > >> Hello, >> for comparison of two trees I can use very nice function cophyloplot >> plotting >> two trees (left and right) and connecting respective nodes by lines. Very >> nice >> and convenient to read. But only for two trees. Displaying multiple trees >> in >> multiple comparisons is not very convenient. >> To display dozens to hundreds of trees there is densitree. Also nice, but >> for >> this purpose I don't like its display. >> I have several trees (~5) and I wish to compare their topologies, show >> supports (at least for differing nodes) and highlight differences. I >> thought >> about some overlay/parallel plotting (similar to the attached image) where >> there would be complete topologies displayed and incongruences would be >> easily >> visible. It would be probably doable by plotting all separate trees by >> plot.phylo and then combining and tuning the figure in some vector editor >> (like Inkscape). But I hope there is some more automated way to do it. :-) >> Sincerely, >> V. >> >> >> >> ___ >> R-sig-phylo mailing list - R-sig-phylo@r-project.org >> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo >> Searchable archive at http://www.mail-archive.com/r- >> sig-ph...@r-project.org/ >> >> > ___ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r- > sig-ph...@r-project.org/ > -- Klaus Schliep Postdoctoral Fellow Revell Lab, University of Massachusetts Boston http://www.phangorn.org/ [[alternative HTML version deleted]] ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi Vojtěch. This kind of plot is possible to make using plotTree in phytools via the arguments tips (which sets the vertical coordinates of the tips, regardless of topology) & add (a logical value indicating whether to add the tree tree to an existing plot or to open a new plot). (All arguments for plotTree are documented in the man page for plotSimmap which plotTree uses internally.) Unfortunately, there is some complication. For instance, unless we set xlim & ylim, then plotTree will reset these values for each new plotted tree. Later this evening I will do my best to make an example & post it to my blog. - Liam Liam J. Revell, Associate Professor of Biology University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://blog.phytools.org On 4/25/2017 12:20 PM, Vojtěch Zeisek wrote: Hello, for comparison of two trees I can use very nice function cophyloplot plotting two trees (left and right) and connecting respective nodes by lines. Very nice and convenient to read. But only for two trees. Displaying multiple trees in multiple comparisons is not very convenient. To display dozens to hundreds of trees there is densitree. Also nice, but for this purpose I don't like its display. I have several trees (~5) and I wish to compare their topologies, show supports (at least for differing nodes) and highlight differences. I thought about some overlay/parallel plotting (similar to the attached image) where there would be complete topologies displayed and incongruences would be easily visible. It would be probably doable by plotting all separate trees by plot.phylo and then combining and tuning the figure in some vector editor (like Inkscape). But I hope there is some more automated way to do it. :-) Sincerely, V. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Hi there, treespace would be an alternative, but its usefulness for 5 trees will be quite limited. Just in case: https://github.com/thibautjombart/treescape Cheers Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org sites.google.com/site/thibautjombart/ github.com/thibautjombart Twitter: @TeebzR +44(0)20 7594 3658 On 25 April 2017 at 18:20, Vojtěch Zeisek wrote: > Hello, > for comparison of two trees I can use very nice function cophyloplot plotting > two trees (left and right) and connecting respective nodes by lines. Very nice > and convenient to read. But only for two trees. Displaying multiple trees in > multiple comparisons is not very convenient. > To display dozens to hundreds of trees there is densitree. Also nice, but for > this purpose I don't like its display. > I have several trees (~5) and I wish to compare their topologies, show > supports (at least for differing nodes) and highlight differences. I thought > about some overlay/parallel plotting (similar to the attached image) where > there would be complete topologies displayed and incongruences would be easily > visible. It would be probably doable by plotting all separate trees by > plot.phylo and then combining and tuning the figure in some vector editor > (like Inkscape). But I hope there is some more automated way to do it. :-) > Sincerely, > V. > > -- > Vojtěch Zeisek > https://trapa.cz/en/ > > Department of Botany, Faculty of Science > Charles University, Prague, Czech Republic > https://www.natur.cuni.cz/biology/botany/ > > Institute of Botany, Czech Academy of Sciences > Průhonice, Czech Republic > http://www.ibot.cas.cz/en/ > > ___ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
Re: [R-sig-phylo] Graphically comparing multiple trees
Very interested in this too! Jake > On Apr 25, 2017, at 1:20 PM, Vojtěch Zeisek wrote: > > Hello, > for comparison of two trees I can use very nice function cophyloplot plotting > two trees (left and right) and connecting respective nodes by lines. Very > nice > and convenient to read. But only for two trees. Displaying multiple trees in > multiple comparisons is not very convenient. > To display dozens to hundreds of trees there is densitree. Also nice, but for > this purpose I don't like its display. > I have several trees (~5) and I wish to compare their topologies, show > supports (at least for differing nodes) and highlight differences. I thought > about some overlay/parallel plotting (similar to the attached image) where > there would be complete topologies displayed and incongruences would be > easily > visible. It would be probably doable by plotting all separate trees by > plot.phylo and then combining and tuning the figure in some vector editor > (like Inkscape). But I hope there is some more automated way to do it. :-) > Sincerely, > V. > > -- > Vojtěch Zeisek > https://trapa.cz/en/ > > Department of Botany, Faculty of Science > Charles University, Prague, Czech Republic > https://www.natur.cuni.cz/biology/botany/ > > Institute of Botany, Czech Academy of Sciences > Průhonice, Czech Republic > http://www.ibot.cas.cz/en/ > ___ > R-sig-phylo mailing list - R-sig-phylo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo > Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/ ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
[R-sig-phylo] Graphically comparing multiple trees
Hello, for comparison of two trees I can use very nice function cophyloplot plotting two trees (left and right) and connecting respective nodes by lines. Very nice and convenient to read. But only for two trees. Displaying multiple trees in multiple comparisons is not very convenient. To display dozens to hundreds of trees there is densitree. Also nice, but for this purpose I don't like its display. I have several trees (~5) and I wish to compare their topologies, show supports (at least for differing nodes) and highlight differences. I thought about some overlay/parallel plotting (similar to the attached image) where there would be complete topologies displayed and incongruences would be easily visible. It would be probably doable by plotting all separate trees by plot.phylo and then combining and tuning the figure in some vector editor (like Inkscape). But I hope there is some more automated way to do it. :-) Sincerely, V. -- Vojtěch Zeisek https://trapa.cz/en/ Department of Botany, Faculty of Science Charles University, Prague, Czech Republic https://www.natur.cuni.cz/biology/botany/ Institute of Botany, Czech Academy of Sciences Průhonice, Czech Republic http://www.ibot.cas.cz/en/ signature.asc Description: This is a digitally signed message part. ___ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/