ggtree
ggtree copied to clipboard
Feature Request: Adding text/values to gheatmap layers
Hi there,
I would find very useful if it would be possible to add values to gheatmap cells. The gheatmap function allows to easily display a matrix of cells colored from values taken in a dataframe. However, I can't find a way to display the values from which the colors are drawn. As an example, the regular heatmap.2 function include the "cellnote =" argument which read a list of strings that will be displayed within each color cell.
Looking forward to hear back from this suggestion. Let me know if this require more details.
All the best, and thanks for the great work you guys are doing.
Adrien
For gheatmap
to automatically add text label, there are some issues need to be considered:
- it is hard to adjust the text to fit the heatmap cell
-
ggfittext can solve this issue but I don't want
ggtree
to depend too much packages.
-
ggfittext can solve this issue but I don't want
- it is hard to support circular layout, see https://github.com/tidyverse/ggplot2/issues/2946.
Currently you can use the methods introduced in https://github.com/GuangchuangYu/plotting_tree_with_data.
What you need is using facet_plot
to visualize heatmap by geom_tile
and text by geom_text
.
Hi @GuangchuangYu ,
Thank you for creating a wonderful package ggtree.
After 3 years, I also have the same question as @ghost. I have created a heatmap using gheatmap and I want fill my cells with values (numbers in my case). Can please redirect how we can use ggfittext
or any other to achieve the same.
Thanks in advance.
I would say that this issue was solved in the ggtreeExtra package, see examples in https://github.com/YuLab-SMU/plotting-tree-with-data-using-ggtreeExtra.
Hi there,
I actually am looking to do this same thing as ghost and ramadatta, but I'm not sure what examples you're referring to in https://github.com/YuLab-SMU/plotting-tree-with-data-using-ggtreeExtra ?