服务热线
178 0020 3020
Part1
直方图
library('ggplot2')
data<-read.csv(file.choose())
ggplot(data, aes(x=bwt, fill = factor(data$smoke)))+geom_histogram(binwidth = 400,position="dodge", color= "red") +labs(x="birth weight", y="count")+ ggtitle("R2-06-dean")+scale_fill_brewer(labels = c("NO","YES"),name="Smoke")
Part2
密度图
library(ggplot2)
ggplot(diamonds,aes(x=price,color=color))+geom_line(stat="density")+xlab("price")+ggtitle("R2-06")+theme_bw()
附件