https://twitter.com/kurai_yousei/status/799532564633518080

这个Diego在推特上问的问题,他最近在写一个motiftools的R包,里面用了ggtree来画图,我想他应该是要解决他在包里的画树/聚类功能吧。

他问题写的horizontal,但其实plot.hclust默认是vertical,ggtree默认也是horizontal,所以我认为他问的是vertical layout,这个在我的回答中也得到了他的确认。

Continue reading

这是最近github上的问题,如何反转time scale,也就是把最近的时间设为0。而内部节点为距今多少年,这个很容易,把x轴的值变成x-max(x)就可以,感觉这个也只会在时间树上使用,所以取名revts(reverse time scale),revts之后,x轴最大值是0,其它为负数,可以使用scale_x_continuous改label为绝对值。

Continue reading

A ggtree user recently asked me the following question in google group:

I try to plot long tip labels in ggtree and usually adjust them using xlim(), however when creating a facet_plot xlim affects all plots and minimizes them.

Is it possible to work around this and only affect the tree and it’s tip labels leaving the other plots in facet_plot unaffected?

This is indeed a desire feature, as ggplot2 can’t automatically adjust xlim for text since the units are in two different spaces (data and pixel).

Continue reading

ggtree provides gheatmap for visualizing heatmap and msaplot for visualizing multiple sequence alignment with phylogenetic tree.

We may have different data types and want to visualize and align them with the tree. For example, dotplot of SNP site (e.g. using geom_point(shape='|')), barplot of trait values (e.g. using geom_barh(stat='identity')) et al.

To make it easy to associate different types of data with phylogenetic tree, I implemented the facet_plot function which accepts a geom function to draw the input data.frame and display it in an additional panel.

Continue reading

Author's picture

Guangchuang Yu

Bioinformatics Professor @ SMU

Bioinformatics Professor

Guangzhou