I have a heatmap:
library(tidyverse)
df = data.frame(V1 = letters[1:10], V2 = letters[11:20], estimate = rnorm(10), meta_group = c(rep("class_1", 3), rep("class_2", 2), rep("class_3", 5)))
df %>%
ggplot(aes(x=V1, y=V2, fill=estimate)) +
geom_tile()
I would like the x-axis labels to be the corresponding values in meta_group
, but for a single label to span the entire range of x-axis values for that meta_group
value. Like this ("c2" should be "class_2" I just ran out space):
How can I achieve this?