thackl / gggenomes

A grammar of graphics for comparative genomics
https://thackl.github.io/gggenomes/
Other
572 stars 64 forks source link

Draw a combined plot with ggtree and gggenomes #158

Closed WRran-Hydrogen closed 9 months ago

WRran-Hydrogen commented 11 months ago

Dear @thackl

Mapping genomes with gggenomes is very convenient and trendy, but adding a clustering tree to a large number of genome maps is also of some use, can ggtree be used in conjunction with gggenomes? This would also allow for sorting the geom_bin_label plotted by gggenomes

Best!

thackl commented 11 months ago

Yes, absolutely. Check out the pick_by_tree() examples here: https://thackl.github.io/gggenomes/reference/pick.html

WRran-Hydrogen commented 10 months ago

This is a very good function, if I knew this function earlier I do not have to sort genome map and then use illustrator to manually splice the tree file, but the function is still not perfect in that there is no complete genome is not fully aligned branches, but it is good enough to use. Thanks to the author! image

thackl commented 9 months ago

That's because both of your plots have slightly different y-scales. You can match them up with scale_y_continuous(expand...) and/or https://ggplot2.tidyverse.org/reference/expand_limits.html. See here for a bit more complex example https://thackl.github.io/ggtree-composite-plots