服务热线
178 0020 3020
#R2-2-1
library("ggplot2")
mydata <- read.csv(file.choose())
str(mydata)
mydata$smoke <- as.factor(mydata$smoke)
ggplot(mydata,aes(x = bwt,fill = smoke)) +
geom_histogram(binwidth = 400,position = "dodge") +
ggtitle("R2-2-1-Adobe_Freeman") +
xlab("birth weight") +
scale_fill_discrete(h=c(0,200),c=600,l=c(10,100),labels = c("no","yes"))#R2-2-2
library("ggplot2")
diamonds$color <- as.factor(diamonds$color)
str(diamonds)
ggplot(diamonds,aes(x = carat,color = color)) +
geom_density(size = 0.3) +
ylab("density")
ggplot(diamonds,aes(x = price,y = ..density..,color = color)) +
geom_line(stat = "density",size = 0.3,adjust = 1) +
ylab("density") +
ggtitle("R2-2-2-Adobe_Freeman") +
theme_bw()
附件