服务热线
178 0020 3020
图一
library(ggplot2)
setwd("C:\\Users\\Thinkpad\\Desktop\\R2-2.1")
data<-read.csv("R2-2.1.csv")
Smoke<-factor(data$smoke)
ggplot(data,aes(x=bwt,fill=Smoke))+geom_histogram(binwidth=500,colour="black",position="dodge")+ggtitle("R2-19")+xlab("birth weight")+scale_fill_discrete(h=c(0,200),c=400,name="Smoke",labels=c("no","yes"))
图二
ggplot(diamonds,aes(x=price,color=color))+geom_line(stat="density")+ggtitle("R2-19")+theme_bw()
附件