服务热线
178 0020 3020
任务1
library(ggplot2)
a<-read.csv("/Users/liutianzi/Desktop/R2/2.csv",head=T)
a$smoke<-factor(a$smoke)
ggplot()+geom_histogram(data=a,aes(x=bwt,fill=smoke),position="dodge",color="black",binwidth=400)+xlab("birth weight")+ggtitle("R2-21")+scale_fill_discrete(labels=c("No","Yes"))
任务2
ggplot(diamonds,aes(x=price,color=color))+geom_line(stat="density")+theme_bw()+theme(panel.border = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),axis.line = element_line(colour = "black"))+ggtitle("R2-21")
附件