服务热线
178 0020 3020
直方图
> library(ggplot2)
> dat1 = read.csv(file.choose(),header = T,stringsAsFactors = F)
> dat1$smoke = factor(dat1$smoke,levels = c(0,1),labels = c("NO", "YES"))
> ggplot(dat1,aes(x = bwt,fill = smoke))+geom_histogram(binwidth = 400, position="dodge", alpha = 0.4)+labs(x="birth weight",y="count")+ggtitle("R2-29-CC")+theme(title = element_text(face="bold"),axis.title.x=element_text(face="bold"),axis.title.y = element_text(face="bold"),legend.text = element_text(face="bold"))
密度图
> ggplot(diamonds,aes(x=price,colour = color))+geom_line(stat = "density",size = 0.8)+ggtitle("R2-29-CC")+theme(title = element_text(face = "bold"),axis.title.x = element_text(face = "bold"),axis.line.y = element_text(face = "bold"),legend.text = element_text(face = "bold"))
附件