R ggbiplot-如何在绘图中不使用特征向量
我有一个datasetdata$cell\u line.sva,它的dim为313 11875R ggbiplot-如何在绘图中不使用特征向量,r,ggbiplot,R,Ggbiplot,我有一个datasetdata$cell\u line.sva,它的dim为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
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)
cc.pca您需要使用varname.size参数来实现这一点
使用文档中的示例:
data(wine)
wine.pca <- prcomp(wine, scale. = TRUE)
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1,
groups = wine.class, ellipse = TRUE, circle = TRUE))
你有你想要的 我不太明白这将如何产生一个有用的结果,但不管怎样,还是这样。这些名称不是函数允许您通过参数设置抑制的内容,至少对我阅读代码和帮助页面是这样。因此,在代码中,因子的标签似乎是从prcomp对象的$rotations元素中提取出来的。尝试将这些名称全部设置为空白字符会产生错误,因此我成功地将a值设置为不同长度的空白字符
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
data(wine)#需要一个可复制的示例,请使用帮助页面
wine.pca我不能只发表评论,因为我还没有必要的信誉点,但是通过将var.axes
设置为false,删除箭头和名称非常容易:
ggbiplot(wine.pca, obs.scale = 1, var.scale = 1,
groups = wine.class, ellipse = TRUE,
circle = TRUE, var.axes=FALSE)
好吧,我用一种非常残忍的方式来做这件事
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1,
groups = wine.class, ellipse = TRUE, circle = TRUE,
varname.size=0, varname.adjust = 20))
它只是将变量名的偏移量设置为超出绘图限制。我可以这样解释图表吗:酒精
和MalicAcid
分别占三组变量的36.2%和19.2%?我真的不知道。在这种情况下,我只是在破解代码以交付所请求的MOD,而不了解基本的统计解释。有没有办法删除箭头?听起来像是另一个问题。有没有办法删除箭头?
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1,
groups = wine.class, ellipse = TRUE, circle = TRUE,
varname.size=0, varname.adjust = 20))