chap 3.9 含权数据

2021-02-18  本文已影响0人  陆慕熙
# 未加权
ggplot(midwest,aes(percwhite,percbelowpoverty))+
  geom_point()
image.png
# 以人口加权
ggplot(midwest,aes(percwhite,percbelowpoverty))+
  geom_point(aes(size=poptotal/1e6))+
  scale_size_area("Population\n(millions)",breaks=c(05,1,2,4))
image.png

增加weight

ggplot(midwest,aes(percwhite,percbelowpoverty))+
  geom_point(aes(size=poptotal/1e6))+
  geom_smooth(aes(weight=poptotal),method = lm,size=1)+
  scale_size_area(guide="none")
image.png
上一篇下一篇

猜你喜欢

热点阅读