tanglegram | Plot tanglegrams from two dendrograms | Data Visualization library
kandi X-RAY | tanglegram Summary
kandi X-RAY | tanglegram Summary
Python wrapper for scipy and matplotlib to plot tanglegrams from two dendrograms
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of tanglegram
tanglegram Key Features
tanglegram Examples and Code Snippets
import tanglegram as tg
import matplotlib.pyplot as plt
import pandas as pd
# Generate two distance matrices and just switch labels in one
labelsA= ['A', 'B', 'C', 'D']
labelsB= ['B', 'A', 'C', 'D']
data = [[ 0, .1, .4, .3],
[.1, 0, .5,
Community Discussions
Trending Discussions on tanglegram
QUESTION
I am using cophyloplot to create a tanglegram of two phylogenetic trees. The method works well with small trees but as the trees get larger the output image remains the same size and I can't find a way to expand it.
Below is the code for a small tree that works fine (basically same as example at: https://www.rdocumentation.org/packages/ape/versions/5.4-1/topics/cophyloplot):
...ANSWER
Answered 2020-Nov-21 at 13:52The tanglegram function comes with many options to improve the output of the image you get (especially the arguments lab.cex and margin_inner). Probably the biggest factor though is external to tanglegram and is the size of your graphic device (via dev.new), so playing with the width and height there would probably solve most of the issue
Here is a simple self contained code that shows how to play with these options to get a nice output.
QUESTION
I have a database I did hierarchical clustering on (with agnes()
) and it worked well (I did it like here described: https://uc-r.github.io/hc_clustering. Now I want to compare manmade clusters or classes in the database with the ones that the hierarchical clustering found. I think I can do this with tanglegram()
.
I do not know how to generate a dendrogram/ doing hierarchical clustering when I already have groups. How can I tell R about the groups?
It would be great if you could answer this question methodical.
`
ANSWER
Answered 2020-Mar-30 at 12:08To compare the clusters visually you can use plotDendroAndColors()
function from WGCNA
package. The function simply displays custom color information for each object under the dendrogram.
I cannot reproduce your example (the packages you used in your code are not specified), so I am demonstrating this using a simple clustering of iris
dataset:
QUESTION
I am creating tanglegrams with the following code:
...ANSWER
Answered 2019-Jul-23 at 20:49You can construct a column in dd
that checks if the line will be horizontal. Here I grouped by label and checked whether the number of unique id's is 1. Then you use that column to the color
argument in the aes
of the line.
QUESTION
I am currently working on creating a tanglegram where species reared are on one side and substrate reared on is on the other side. However, I need the output to also be a tanglegram, having each side of the chart be the tips of a dendogram. I currently have phylogenies of both the species and substrates in Newick formats.
I successfully used the 'ape' package and the plot.phylo()
function to generate the 2 phylogenies. I then used the following code from this post to export the order of tips:
ANSWER
Answered 2018-Oct-15 at 23:57You can use the function cophylo
from the phytools
package:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tanglegram
[Pandas](http://pandas.pydata.org/)
[SciPy](http://www.scipy.org)
[Numpy](http://www.scipy.org)
[Matplotlib](http://www.matplotlib.org)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page