散点图也是目前R中的常用的图形之一

geom_point(mapping = NULL, data = NULL, stat = "identity", position = "identity",  na.rm = FALSE, ...)

从参数来看基本上也是常规的参数

 

下面来看些具体例子

library(ggplot2)
p<-ggplot(economics,aes(pop,psavert))
p+geom_point()

ggplot2 geom设置—散点图  

p+geom_point(aes(color=pce))

ggplot2 geom设置—散点图

p+geom_point(colour="grey50", size = 4)+geom_point(aes(color=pce))

利用两个geom_point()函数画叠加图,不过要注意先后顺序,前面的通常会被覆盖,所有需要在大小颜色等属性上设置不同,避免被全部覆盖

ggplot2 geom设置—散点图

  

p+geom_point(colour="red", size = 5)+geom_point(aes(alpha=pce,size=uempmed))

ggplot2 geom设置—散点图  

 

相对而言,geom_point()基本用法也相对比较简单,当然可以结合其他参数做出更好的图形。

相关文章:

  • 2022-01-23
  • 2021-10-13
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-04-13
  • 2021-11-10
猜你喜欢
  • 2022-01-09
  • 2021-12-24
  • 2021-07-21
  • 2021-12-02
  • 2021-10-28
  • 2022-12-23
相关资源
相似解决方案