[关闭]
@Macux 2015-12-01T06:46:18.000000Z 字数 851 阅读 975

R语言_ggplot2_Lv2_Point

R语言_学习笔记


  1. > ggplot(faithful,aes(eruptions,waiting)) + geom_point(color="skyblue") + geom_rug(position="jitter",size=0.2,color="darkorange3")

此处输入图片的描述


  1. > cdat <- subset(countries,Year==2009 & Name %in% c("Canada","Ireland","United Kingdom","New Zealand","Iceland","Japan","Luxembourg","Netherlands","Switzerland"))
  2. > ggplot(cdat,aes(healthexp,infmortality)) + geom_point(aes(size=GDP),shape=21,color="black",fill="cornsilk") + scale_size_area(max_size=12)

此处输入图片的描述


  1. > library(plyr)
  2. > library(MASS)
  3. > birthwt$smoke <- revalue(factor(birthwt$smoke),c("0"="No Smoke","1"="Smoke"))
  4. > ggplot(birthwt,aes(bwt,..density..)) + geom_histogram(binwidth=200,fill="cornsilk",color="gray60",size=0.2) + geom_density() + facet_grid(smoke~.,space="free")

此处输入图片的描述

-What can revalue function do for us?
-Replace specified values with new values, in a factor or character vector.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注