简体   繁体   中英

Remove space between gheatmap tiles

I'm creating a tree with a ggtree and gheatmap. I am trying to work out how to remove the space between the tip tiles and/or merge adjacent tiles with the same value.

Below is the code I used:

library(ape)
library(tidyverse)
library(ggtree)

tree <- rtree(50)
tree_plot <- ggtree(tree, size = 1, layout = "circular", branch.length = "none")

dummy_data <- data.frame(data = c(rep(1,10),rep(2,10),rep(3,10), rep(4,10), rep(5,10)))
row.names(dummy_data) <- tree$tip.label

gheat_Sensitivity <- gheatmap(p = tree_plot, data=dummy_data, width=0.1, colnames = FALSE) +
new_scale(aes(color = dummy_data)) +
scale_fill_gradientn(colors = c("grey", "yellow"), breaks = c(1, 5.0))

plot(gheat_Sensitivity)

This creates the tree I am after: ggtree plot

However I would like to remove the spacing between the heatmap tiles so that there is a continuous look to it. Specifically, I would like adjacent tiles with the same value to look like one larger tile.

Any help would be very appreciated, Cheers, Tom

Bit late, but for anyone else who has the same issue, you can add colour=NA to the gheatmap call, ie

gheatmap(p = tree_plot, data=dummy_data, width=0.1, colnames = FALSE, color=NA) 

See here - heatmap with the left with the row space, right after using color=NA.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM