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
When circular trees are annotated with the gheatmap function the colnames of the associated data are plotted by default in a gap of the annotation ring. With colnames = FALSE it is possible to prevent showing the titles but the gap remains (see plot p1). If one wants to generate a closed annotation ring “+ scale_y_continuous(expand = c(0,0))” has to be applied (p2). I assume the gap it is caused by the ggplot::geom_tile behaviour which adds some space at the ends of the plot but (as I can say from experience) it takes some time to find the solution. Would it be possible for you to change your gheatmap function in such way, that “+ scale_y_continuous(expand = c(0,0))” is directly applied if colnames = FALSE.
Thanks
Examples:
library("ggplot2")
library("ggtree") # version 1.13.6
library("dplyr")
## load example tree from package
nwk <- system.file("extdata", "sample.nwk", package="treeio")
tree <- read.tree(nwk)
## circular tree
circ <- ggtree(tree, layout = "circular") +
geom_tiplab(size=3, color="black", align=TRUE, offset = 1)
## external data which should be attached
df <- data.frame(habitat=c("a", "b", "a", "c", "d", "d", "a", "b", "e", "e", "f", "c", "f"))
row.names(df) <- pull(circ$data[circ$data$isTip=="TRUE", "label"])
## circular tree with heatmap without colname but remaining gap
p1 <- gheatmap(circ, df[,"habitat", drop=FALSE], offset = 0.8, width=0.1,
colnames = FALSE)
p1
## circular tree with heatmap without gap
p2 <- gheatmap(circ, df[,"habitat", drop=FALSE], offset = 0.8, width=0.1,
colnames = FALSE) +
## close gap
scale_y_continuous(expand = c(0,0))
p2
The text was updated successfully, but these errors were encountered:
When circular trees are annotated with the gheatmap function the colnames of the associated data are plotted by default in a gap of the annotation ring. With colnames = FALSE it is possible to prevent showing the titles but the gap remains (see plot p1). If one wants to generate a closed annotation ring “+ scale_y_continuous(expand = c(0,0))” has to be applied (p2). I assume the gap it is caused by the ggplot::geom_tile behaviour which adds some space at the ends of the plot but (as I can say from experience) it takes some time to find the solution. Would it be possible for you to change your gheatmap function in such way, that “+ scale_y_continuous(expand = c(0,0))” is directly applied if colnames = FALSE.
Thanks
Examples:
The text was updated successfully, but these errors were encountered: