服务热线
178 0020 3020
>library("ggplot2")
>data1<-
+read.csv(file.choose("F:R语言学习/R2-2.1/R2-2.1.csv"))
>data1$smoke<-factor(data1$smoke)
>ggplot(data1,aes=(x=bwt,fill=smoke))+geom_histogram(binwidth=400,position="dodge",color="black")+xlab("birth weight")+ylab("count")+scale_fill_discrete(label=c("No","Yes"))+ggtitle("R2-16")
>ggplot(diamonds,aes(x=price,color=color))+geom_line(stat="density",size=0.5)+theme_bw()+xlab("price")+ylab("density")+ggtitle("R2-16")
附件