library(tidyverse)
heatmap <- tibble(col1 = c(rep("A", 3), rep("B", 3), rep("C", 3)),
col2 = rep(c("I", "II", "III"), 3),
col3 = c(1:8, NA))
#> # A tibble: 9 x 3
#> col1 col2 col3
#> <chr> <chr> <dbl>
#> 1 A I 1
#> 2 A II 2
#> 3 A III 3
#> 4 B I 4
#> 5 B II 5
#> 6 B III 6
#> 7 C I 7
#> 8 C II 8
#> 9 C III NA
ggplot(heatmap, aes(col1, col2)) + geom_tile(aes(fill = col3))
The heat map above has a grey square representing the "NA" value in my heatmap
data frame. How do I change the color of this square to red? This code does not work. It is just red outlines.
ggplot(heatmap, aes(col1, col2)) + geom_tile(aes(fill = col3), color = "red")
I assume the NA
square is the lack of a drawing, and is transparent and showing some type of ggplot base background (the grey square you actually see). Maybe I need to change this base background color? Do you know?