So I created a heatmap using geom_tile() as follows:
df_temp <- df_master
df_temp$X <- c(1:length(df_master$CHR))
df_temp[ ,c('CHR')] <- list(NULL)
df_temp <- melt(df_temp, id.vars="X")
n1 <- length(unique(df_temp$variable))
n2 <- length(unique(df_temp$X))
ggplot(df_temp, aes(x = X, y = variable, fill = value))
theme(axis.title.x = element_blank())
theme(axis.ticks.x = element_blank(),
axis.text.x = element_blank())
geom_tile()
scale_fill_gradientn(
colors=c("grey","orange","dark red"), na.value="grey",
values=rescale(c(0,5,40)),
limits=c(0,40))
geom_line(data = data.frame(x = c(0, n2) 0.5, y = rep(2:n1, each = 2) - 0.5),
aes(x = x, y = y, group = y), size=1, colour = 'white', inherit.aes = FALSE)
Data used
set.seed(1)
df_temp <- data.frame(X = rep(1:25, 6),
variable = rep(LETTERS[1:6], each = 25),
value = runif(25 * 6, 0, 2),
CHR = rep(paste("CHR",
rep(1:5, times = c(6, 4, 3, 7, 5))), 6))