I'm trying to plot a parallel coordinate plot with a dataset that has 1270 dimensions/variables, and the plot appears to be all a grey area because of the background grid (if I plot the same dataset with 800 dimensions I still get the grid occupying most of the space but you can see more or less the plot).
Does anyone know how can I delete this background grid?
parcoord(mywines_spectra[,2:800], col = mywines_parameters$name)
parcoord(mywines_spectra[,2:ncol(mywines_spectra)], col = mywines_parameters$name)]
Vertical lines are hardcoded in the function, there is no option of changing them. We can copy the function and update as needed:
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)