服务热线
178 0020 3020
直方图:
> library(ggplot2)
> R1<-read.csv("/Users/LUCY/Desktop/科研狗R语言第二期/2-3/R2-2.1.csv")
> g<- ggplot(R1,aes(x=bwt,fill=factor(R1$smoke)))
> g+geom_histogram(binwidth=400,colour="black",position="dodge")
+labs(x="birth weight",title="R2-14")
+scale_fill_discrete(h=c(0,200),c=400,name="Smoke",labels = c("no","yes"))
任务二:
g<- ggplot(diamonds,aes(x=carat))
g+geom_line(stat = "density",aes(color=color),size=0.3) +labs(x="price",y="density",title="R2-14")
附件