R 白色填充在ggplot2中

R 白色填充在ggplot2中,r,ggplot2,R,Ggplot2,我不知道如何获得这个ggplot2图形的白色填充 set.seed(12345) Row <- rep(x = 1:4, times = 3) Col <- rep(x = 1:3, each = 4) Trt <- c("A", "B", "A", "C", "D", "B", "C", "D", "A", "C", "B", "B") Y <- rnorm(n = 12, mean = 0, sd = 1) Y2 <- paste(Trt, round(Y

我不知道如何获得这个ggplot2图形的白色填充

set.seed(12345)
Row <- rep(x = 1:4, times = 3)
Col <- rep(x = 1:3, each = 4)
Trt <- c("A", "B", "A", "C", "D", "B", "C", "D", "A", "C", "B", "B")
Y   <- rnorm(n = 12, mean = 0, sd = 1)
Y2 <-  paste(Trt, round(Y, 3), sep = "=")
Y3 <- rep(x = 1, times = 12)

dat <- data.frame(Row, Col, Trt, Y, Y2, Y3)

library(ggplot2)

p <- ggplot(data =  dat, aes(x = Row, y = Col)) +
      geom_tile(aes(fill = Y3, colour = "white"), colour = "black") +
      geom_text(aes(label = Trt, colour = Trt),  vjust = -1) +
      geom_text(aes(label = round(Y, 3), colour = Trt), vjust = 1)+
      labs(x = NULL,y = NULL) +
      opts(axis.ticks = theme_blank(), axis.text.x = theme_blank(), axis.text.y = theme_blank()) +
      opts(legend.position="none")

p
set.seed(12345)

行我相信您想要
geom_tile(color='black',fill='white')