ggplot2:point在legend中的size修改

2023-09-26 02:43:33 浏览数 (1)

代码语言:javascript复制
library(tidyverse)
dt <- diamonds[1:1000, ]

如题:

代码语言:javascript复制
p1 <- dt %>% 
  ggplot(aes(x = carat, y = cut, color = cut))  
  geom_point()  
  labs(title = "修改前")
p2 <- dt %>% 
  ggplot(aes(x = carat, y = cut, color = cut))  
  geom_point()  
  guides(color = guide_legend(override.aes = list(size = 3)))  
  labs(title = "修改后")
p1   p2
Figure 1Figure 1

0 人点赞