R(week 7)

x <- rnorm(100)
x
hist(x, col = "lightblue")
qqnorm(x)

airquality
?airquality
dim(airquality)
head(airquality)
plot(airquality$Wind, airquality$Ozone)
nrow(airquality)
tail(airquality)
dev.off()
dev.new()

png('airquality_plot.png', width = 6.5, height=5, units='in', res = 600)
plot(airquality$Wind, airquality$Ozone)

#
png('sss.png', width = 500, height = 300)
plot(airquality$Wind, airquality$Ozone)
dev.off()
plot(airquality$Wind, airquality$Ozone, 
     main = "sdfdsf\nhahhaha", xlab="aaa", ylab="bbb")
plot(airquality$Wind, airquality$Ozone, 
     main = "sdfdsf\nhahhaha", xlim=c(0, 30), ylim=c(0,200))

plot(airquality$Wind, airquality$Ozone, 
     main = "sdfdsf\nhahhaha", xlab="aaa", ylab="bbb",
     pch = 8, col = 4, cex = 1.2, 
     type = 'l')

x <- rnorm(100)
opp <- par(mfrow = c(2, 2))
hist(x)
boxplot(x)
qqnorm(x)

dev.off()
dev.new()
mat <- rbind(1, 2:4)
layout(mat)
hist(x)
boxplot(x)

library(ggplot2)
head(mtcars)
tail(mtcars)
view(mtcars)

qplot(x=wt, y=mpg, data = mtcars)+
  ggtitle("sdfsdfsd")+
  theme(plot.title=element_text(hjust=0.5))+
  xlab("xxxxx")+
  ylab("yyyyy")+
  xlim(c(1, 6))+
  xlim(c(0, 8))

  

posted @ 2021-04-12 17:37  sinEagle  阅读(37)  评论(0编辑  收藏  举报