Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R中是否有生成此图像的包和函数?_R_Plot_Distribution_Correlation_Scatter Plot - Fatal编程技术网

在R中是否有生成此图像的包和函数?

在R中是否有生成此图像的包和函数?,r,plot,distribution,correlation,scatter-plot,R,Plot,Distribution,Correlation,Scatter Plot,有没有在R中生成此图像的软件包? 我想看看一些变量的相关性、分布和散点图。你可以用 library(psych) pairs.panels(iris[,-5], hist.col="white", scale=TRUE) 此图可完全根据?pairs下给出的示例构建 panel.hist <- function(x, ...) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(usr[1:2], 0, 1.5) )

有没有在R中生成此图像的软件包?

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

你可以用

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

此图可完全根据
?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)

panel.hist老实说,虽然这肯定是一个编程问题,属于这里,但通过统计门户网站,您可能会有更好的运气。您可能想看看ggplot2,GGALY。他们可能不会给你确切的答案。但是非常接近。我喜欢它,GGALY很棒。