如何更改ggplot2上的参考线几何内部的背景?

时间:2019-03-01 16:46:52

标签: r ggplot2

我想更改辅助线几何图形中的背景(红色箭头指示的是灰色的背景) enter image description here

 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

1 个答案:

答案 0 :(得分:0)

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