我想知道是否可以为绘图中的列名设置不同的形状而不是标签。我已经展示了一个可重复的例子来获得该图。
#dataset
mtcars
#split the data into different blocks
a<-mtcars[,1:3]
b<-mtcars[,4:6]
c<-mtcars[,7:9]
d<-mtcars[,10:11]
### create a list of dataframes
A<-list(blockA=a, blockB=b,blockC=c,blockD=d)
### design matrix
C <- matrix(c(0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
1, 1, 1, 1), 4, 4)
tau = c(1, 1, 1, 1)
library(mixOmics)
##### computing the sGCCA
wrap.result.sgcca = wrapper.sgcca(data = A, design = C, penalty = rep(1, length(A)),
ncomp = c(2, 2, 2,2), scheme = "centroid", verbose = FALSE)
##### visualization
col <- rep(c("blue", "red", "darkgreen", "darkviolet"))
plotVar(wrap.result.sgcca, col=col, comp = c(1,2),
block = c(1,2,3,4), ncomp.select = c(1,2), labels = TRUE)
在这个情节中,我设法用独特的颜色为这些块着色。我还想用形状来表示列。例如,当我们考虑数据集mtcars的不同列名
时colnames(mtcars)
[1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" "carb"
根据块我分裂了一个(列1:3),b(列(4:6),c(列7:9),d(列10:11),我想要第1,4列, 7,10具有相同的形状(例如圆圈),列2,5,8,11(比方形),列3,6,9(比如星形)。我尝试设置pch值但是未能根据形状生成形状这个情节中的专栏名称。有人可以帮助我吗?谢谢