记录R语言可视化相关的内容
-
plot
散点图,直接使用plot
plot(data$x, data$y, xlab="x", ylab="y", pch=16) # 参数pch设置点的类型
-
限制y范围
plot(ylim=c(0,2),hii_order,xlab="",ylab="",pch=16)
-
散点图矩阵
pairs(data, main="Basic Scatter Plot Matrix") # 基础的散点图矩阵 library(car) scatterplotMatrix(data, spread=F, smoother.args=list(lty=2),regLine=T,smooth = F,main="Scatter Plot Matrix via car Pakage") # 带有分布图的散点图矩阵 library(GGally) ggpairs(data = data) # 美观的变量矩阵
-
带坐标轴的回归结果添加
x1 <- rnorm(50,4,2) e <- rnorm(50,0,0.1) y <- -2 + x1 + e plot(x1, y, xlab="x", ylab="y", ylim=c(-8,8), xlim=c(-8,8), pch=15) # 绘制散点图 abline(h=0, v=0, lty=2) abline(reg=m1, col="black", lwd=2)