R语言系统教程(十):多元数据的图表示方法
10.1 轮廓图
轮廓图的作图步骤如下:
- 作直角坐标系,横坐标取p个点,表示p个向量;
- 对给定的一次观测值,使p个点上的纵坐标与对应的变量取值成正比;
- 连接此p个点得到一个对应折线,即为该次观测值的一格轮廓线;
- 对于n次观测值,重复上述步骤,得到n条折线,即构成n次观测值的轮廓图;
其基于R的函数代码如下:
> outline <- function(x, txt = TRUE){
+ if (is.data.frame(x) == TRUE)
+ x <- as.matrix(x)
+ m <- nrow(x); n <- ncol(x)
+ plot(c(1,n), c(min(x),max(x)), type = "n",
+ main = "The outline graph of Data",
+ xlab = "Number", ylab = "Value")
+ for(i in 1:m){
+ lines(x[i,], col=i)
+ if (<