YuLab-SMU / aplot

Decorate a plot with associated information
https://yulab-smu.top/aplot
92 stars 14 forks source link

Issue with label alignment #11

Open dsgregoire opened 2 years ago

dsgregoire commented 2 years ago

Hello,

First off thank you for the wonderful packages ggtree and aplot. They've made plotting my phylogenetic data very easy.

I am running into multiple issues in R using the 'aplot' package, where I am trying to connect a multi-faceted heatmap made with geom_tile in ggplot2, to a tree I have visualized using ggtree. This heatmap includes numeric data for how complete metabolic pathways are for a subset of genomes in my larger phylogenetic tree. Producing this heatmap using gheatmap or appending it to the tree data %<+% hasn't worked because the code for the heatmap is too complex due to the faceting required. Simply trying to insert the tree to the left with common labels returns the error:

Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 'y'

The issues include:

Outside of these trials, I can't figure out how to connect these plots working from Figure 7B from this link: https://yulab-smu.top/treedata-book/chapter7.html. I've attached a rough copy and paste image from R studio here to illustrate the alignment issues I am having with the labels.

image

Really, I am trying to produce the first two panels of Figure 7B, with the proper alignment, label order, and labels dropped for those that are not in the heatmap dataset.

Any help you can provide on this matter would be much appreciated.