I have been trying to plot a heatmap with the gheatmap function and I wanted the tiles to be seamless i.e. not be separated. I did use the argument "color=NA" in the gheatmap function but this still leads to a thin white line between two tiles when zoomed in on a pdf file for example (see pdf output from code below). Now, my tree has 3000+ tips and the white lines become noticeable as they create unwanted artefacts on the heatmap (see image below). This only happens in the round format trees (circular and fan) and there are no white lines in the rectangular layout. Is there an easy fix to this bug with a function that I am not aware of?
Reproducible bug from anoletree data:
library(ggtree)
library(dplyr)
library(phytools)
anole.tree<-read.tree("http://www.phytools.org/eqg2015/data/anole.tre")
svl<-read.csv("http://www.phytools.org/eqg2015/data/svl.csv",
row.names=1)
svl$svl = pmin(svl$svl, 3)
svl<-as.matrix(svl)[,1]
fit<-fastAnc(anole.tree,svl,vars=TRUE,CI=TRUE)
# Make a dataframe with estimated trait values at the nodes
svl_tip <- data.frame(
node = nodeid(anole.tree, names(svl)),
trait = svl
)
# Make a dataframe with estimated trait values at the nodes
svl_node <- data.frame(node = names(fit$ace), trait = fit$ace)
# Combine these with the tree data for plotting with ggtree
d <- rbind(svl_tip, svl_node)
d$node <- as.numeric(d$node)
tree <- full_join(anole.tree, d, by = 'node')
pdf(file="svl_asr.pdf",width=10,height=15)
p <- ggtree(
tree,
layout = 'circular')
gheatmap(p, data.frame(svl), width=0.04, colnames = FALSE,
legend_title = "SVL", color=NA) +
scale_y_continuous(expand = c(0, 0)) +
ggtitle("SVL Test")
dev.off()
Session Info:
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
I have been trying to plot a heatmap with the gheatmap function and I wanted the tiles to be seamless i.e. not be separated. I did use the argument "color=NA" in the gheatmap function but this still leads to a thin white line between two tiles when zoomed in on a pdf file for example (see pdf output from code below). Now, my tree has 3000+ tips and the white lines become noticeable as they create unwanted artefacts on the heatmap (see image below). This only happens in the round format trees (circular and fan) and there are no white lines in the rectangular layout. Is there an easy fix to this bug with a function that I am not aware of?
Reproducible bug from anoletree data:
Session Info: