# 未加权
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
网友评论