R 如何更改ggplot2上的背景内部辅助线几何图形?

R 如何更改ggplot2上的背景内部辅助线几何图形?,r,ggplot2,R,Ggplot2,我想更改导向几何体内部的背景(红色箭头指示的灰色) 库(ggplot2) dat library(ggplot2) dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5), r = factor(1:5)) p <- ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) + geom_point(

我想更改导向几何体内部的背景(红色箭头指示的灰色)

库(ggplot2)
dat
 library(ggplot2)

    dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5),
                      r = factor(1:5))
    p <- ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) + geom_point()

    p
ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) +
    geom_point() +
    theme(legend.key = element_rect(fill = "green"))