ggbiplot-如何在绘图中不使用特征向量 [英] ggbiplot - how not to use the feature vectors in the plot
问题描述
我有一个数据集 data $ cell_line.sva ,其暗淡值为31311875.
I have a dataset data$cell_line.sva, which has dim of 313 11875.
cc.pca <- prcomp(data$cell_line.sva, center = TRUE, scale. = TRUE, retx = TRUE)
g <- ggbiplot(cc.pca, obs.scale = 1, var.scale = 1, groups = as.factor(cgpResponse), ellipse = TRUE, circle = FALSE)
如何摆脱功能名称? (红色文字)
How can I get rid of the feature names? (the red text)
推荐答案
我无法完全弄清楚这将如何产生有用的结果,但是无论如何这里都是如此.名称不是函数可以通过参数设置隐藏的名称,至少对于我阅读代码和帮助页面而言.因此,看一下代码,看起来好像因素的标签是从prcomp对象的$ rotations元素中拉出的.尝试将所有名称都设置为空白字符会产生错误,因此我成功地将其设置为长度不同的空白值.
I cannot quite figure out how this would yield a useful result, but here goes anyway. The names are not something that the function lets you suppress via parameter settings, at least to my reading of the code and help page. So looking at the code it looks as though the labels for the factors are pulled from the $rotations element of the prcomp object. Trying to set those names all to a blank character created an error so I succeeded by setting to the a value of varying lengths of blanks.
data(wine) # need a reproducible example so use the help page
wine.pca <- prcomp(wine, scale. = TRUE)
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE))
# that was the equivalent of your plot
# Now change the input value
dimnames(wine.pca$rotation)[[1]] <-
Reduce(function(x,y) paste0(x,y), # function to concatentate the lanks
rep(" ",dim(wine.pca$rotation)[1]), # corrrect number of blanks
acc=TRUE) # save all intermediate strings
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class,
ellipse = TRUE, circle = TRUE))
#Look, Ma! No labels
这篇关于ggbiplot-如何在绘图中不使用特征向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!