是否有任何包和功能在R中生成此图像?

par*_*vij 4 plot r distribution scatter-plot correlation

是否有任何包在R中生成此图像? 图片

我想看一些变量的相关性,分布和散点图.

akr*_*run 6

你可以用

 library(psych)
 pairs.panels(iris[,-5], hist.col="white", scale=TRUE)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


jba*_*ums 5

该图可完全由下面给出的例子构成?pairs.

panel.hist <- function(x, ...) {
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(usr[1:2], 0, 1.5) )
  h <- hist(x, plot = FALSE)
  breaks <- h$breaks; nB <- length(breaks)
  y <- h$counts; y <- y/max(y)
  rect(breaks[-nB], 0, breaks[-1], y, ...)
}

panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...) {
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(0, 1, 0, 1))
  r <- abs(cor(x, y))
  txt <- format(c(r, 0.123456789), digits = digits)[1]
  txt <- paste0(prefix, txt)
  if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt)
  text(0.5, 0.5, txt, cex = cex.cor * r)
}

pairs(iris, lower.panel=panel.smooth, upper.panel=panel.cor, 
      diag.panel=panel.hist)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述