主要使用的方法就是 scale_shape_manual,scale_size_manual,scale_color_manual, scale_fill_manual

颜色分为 描变颜色 scale_color_manual 和 填充颜色 scale_fill_manual

重点要注意的是要提前分组,分组的个数和指定参数的个数要相同

ggplot(data, aes(x = numbers, y = length, col = method)) +
  geom_point()

 

ggplot(data, aes(x = numbers, y = length, col = method, shape = method, size = method)) + #col 颜色分组, shape 形状分组, size 大小分组
  geom_point()+
  scale_shape_manual(values = c(1,3,5))+
  scale_size_manual(values = c(3,4,5))+
  scale_color_manual(values = c('#E00303','#03E0B6','#E0BF03'))

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐