2015-09-28 18 views

Trả lời

8

Bạn có thể sử dụng các tham số của legend.keytheme. Đó là

theme(legend.key = element_rect(fill = "black"))

Một ví dụ:

a <- seq(1:5) 
b <- seq(1:5) 
c <- seq(1:5) 
d <- data.frame(a, b, c) 
ggplot(data = d, aes(x = a, y = b, color = factor(c))) + 
    geom_point() + 
    theme(legend.key = element_rect(fill = "yellow")) 

sản xuất:

enter image description here

+0

Hoàn hảo, cảm ơn bạn đã phản hồi nhanh! – wilsonm2

Các vấn đề liên quan