Reputation: 5067
I am having difficulty trying to get labels on my parcoord() plot. If I do :
library(MASS)
data1<-cbind.data.frame("A"=rbind(6,9,10))
data2<-cbind.data.frame("B"=rbind(3,19,1))
parcoord(cbind(data1,data2), col=1, lty=1)
axis(2, at=c(6,9,10), labels=c("this","should","bealabel"))
I do not get labels the left hand side of the plot. How do I fix this?
Upvotes: 1
Views: 1060
Reputation: 73265
Because y-axis
has been rescaled to [0,1]
. Simply try axis(2)
to see what the default axis is. Therefore, when you do at = c(6, 9, 10)
, that is beyond the range hence not displayed. Here is a solution:
y <- c(6, 9, 10)
pos <- (y - min(y)) / diff(range(y)) ## rescaling
parcoord(cbind(data1,data2), col=1, lty=1)
axis(2, at=pos, labels=c("this","should","bealabel"))
Upvotes: 2