基于RStudio实现数据可视化

> layout(matrix(c(1,2,3,3),nrow = 2, ncol = 2, byrow = TRUE), heights = c(2,1))
> par(mai=c(0.6,0.6,0.1,0.1),cex=0.7)
> x<-rnorm(1000)
> y<-rchisq(1000,10)
> hist(x,probability = TRUE, col = "lightblue",xlab = "x", ylab = "Density",ylim = c(0,0.4))
> plot(x,y,xlab = "x",ylab = "销售额",col = "green")
> boxplot(y,col = "red",lwd=1,horizontal = TRUE,varwidth = TRUE)

  

x<-seq(0.25,length=25)
y<-4+0.5*x+rnorm(25,0.2)
d<-data.frame(x,y)
plot(d)
polygon(d[chull(d),],col = "pink",lty = 3,lwd=2)
points(d)
abline(lm(y~x),lwd=2,col=4)
abline(v=mean(x),h=mean(y),lty=2,col="gray70")

  

转载请注明出处,谢谢!

 

posted @ 2018-12-21 14:51  因为专注。所以专业  阅读(2222)  评论(0编辑  收藏  举报