[英]R: getting axis labels on parallel coordinates plot
I am having difficulty trying to get labels on my parcoord() plot. 我很难在我的parcoord()图上获取标签。 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?
我该如何解决?
Because y-axis
has been rescaled to [0,1]
. 因为
y-axis
已重新缩放为[0,1]
。 Simply try axis(2)
to see what the default axis is. 只需尝试
axis(2)
来查看默认轴是什么。 Therefore, when you do at = c(6, 9, 10)
, that is beyond the range hence not displayed. 因此,当您
at = c(6, 9, 10)
,该范围超出范围,因此不会显示。 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"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.