服务热线
178 0020 3020
R2_1 <- read.table(file ="data/R2-2.1.csv", sep = ",", header = TRUE)
library(ggplot2)
ggplot(R2_1,aes(x=bwt,fill=factor(R2_1$smoke)))+
geom_histogram(binwidth=400,position="dodge",color="black")+
ggtitle("R2-26")+xlab("birthweight")+
scale_fill_discrete(h=c(0,200),c=400,name="Smoke",labels=c("No","Yes"))+
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_rect(fill="white"),
axis.line = element_line(colour="black"))
data(diamonds)
library(ggplot2)
ggplot(diamonds,aes(x=carat,color=color))+
geom_line(stat="density")+
ggtitle("R2-26")+xlab("price")+
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
panel.background = element_rect(fill="white"),
axis.line = element_line(colour="black"))
附件