从 parcoord() 函数中移除网格(库 MASS)

Remove grid from parcoord() function (library MASS)

我正在尝试使用具有 1270 dimensions/variables 的数据集绘制平行坐标图,并且由于背景网格的原因,该图似乎全是灰色区域(如果我绘制相同的数据集800 维我仍然得到占据大部分 space 的网格,但你或多或少可以看到情节)。

有谁知道如何删除这个背景网格?

parcoord(mywines_spectra[,2:800], col = mywines_parameters$name)

parcoord(mywines_spectra[,2:ncol(mywines_spectra)], col = mywines_parameters$name)]

垂直线在函数中是硬编码的,没有更改它们的选项。我们可以复制函数并根据需要更新:

myParcoord <- function (x, col = 1, lty = 1, var.label = FALSE, ...) 
{
  rx <- apply(x, 2L, range, na.rm = TRUE)
  x <- apply(x, 2L, function(x) (x - min(x, na.rm = TRUE))/(max(x, 
                                                                na.rm = TRUE) - min(x, na.rm = TRUE)))
  matplot(1L:ncol(x), t(x), type = "l", col = col, lty = lty, 
          xlab = "", ylab = "", axes = FALSE, ...)
  axis(1, at = 1L:ncol(x), labels = colnames(x))
  for (i in 1L:ncol(x)) {
    #lines(c(i, i), c(0, 1), col = "grey70") # <--- this line adds vertical grey lines
    if (var.label) 
      text(c(i, i), c(0, 1), labels = format(rx[, i], 
                                             digits = 3), xpd = NA, offset = 0.3, pos = c(1, 
                                                                                          3), cex = 0.7)
  }
  invisible()
}

myParcoord(mtcars, col = mtcars$cyl)