ggplot2 geom设置—散点图

 散点图也是目前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()

  

p+geom_point(aes(color=pce))

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

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

  

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

  

 

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

posted @ 2016-07-21 22:05  molearner  阅读(15445)  评论(0编辑  收藏  举报