rmass

In using MASS::parcoord() in R for a parallel coordinates plot, how can I customize the range of y-axes of each variable?


When the argument var.label=TRUE, the minimum and maximum observed values dictate the range of what appears on the plot. Does anybody have tips on how to adjust the minimum and maximum labels?

For example:

library(MASS)
MASS::parcoord(iris[,1:3], var.label=TRUE)

,the result is as seen below. Is there a way to make the minimum all start, for example, at 0?

Parallel coordinates plot using iris data:enter image description here


Solution

  • Is there a way to make the minimum all start, for example, at 0?
    

    No, not with that function because as you said, the axes are based on the data, which seems to be hard-coded into the function.

    One way around this is to add a row or rows to the data and specify a different colour for those rows (here white):

    data <- rbind(iris[,1:3], 
                  data.frame(Sepal.Length=c(0,10), 
                             Sepal.Width= c(0,10),
                             Petal.Length=c(0,10)))
    parcoord(data, var.label=TRUE, col=c(rep(1, 150), 0, 0))
    

    enter image description here