You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
KevinLopezReyes
changed the title
Is there possible to add spaces/separation in the squares using gheatmap?
Is it possible to add spaces or separation between the squares using gheatmap?
Sep 25, 2024
Dear Dr. Guangchuang Yu,
I have a question, and I hope you can help me. Thank you.
I am trying to plot a heatmap on a phylogeny, but I want the squares representing my traits to be separated, not connected.
Here is an reproducible example
Load the libraries
library(ggtreeExtra)
library(ggplot2)
library(ggtree)
random data
set.seed(123)
tr <- rtree(5)
tip_ranges <- data.frame(row.names = tr$tip.label, Attribute1 = c("A", "B", "C", "A", "B"),
Attribute2 = c("High", "Low", "Medium", "High", "Medium"))
plot the tree
Fig_1 <- ggtree(tr) +
geom_tiplab()
Fig_1 <- gheatmap(Fig_1, tip_ranges, offset = 0.5, width = 0.5, font.size = 3,
colnames_angle = 0, hjust = 0.5, color = "black",
colnames_position = "top") +
scale_fill_manual(values = c("A" = "blue", "B" = "red", "C" = "green",
"High" = "gold", "Medium" = "lightgreen", "Low" = "gray")) +
theme(legend.position = "none")
print(Fig_1)
The text was updated successfully, but these errors were encountered: