当前ggbiplot(下面的代码)显示X轴值从-5到5,Y轴从-4到4.我如何更改它以使X轴值从-6到6和Y轴从 - 6到6?
感谢。
代码:
library(devtools)
install_github("ggbiplot", "vqv")
library(ggbiplot)
data(wine)
ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, group=wine.class,
varname.size = 8, labels.size=10,
ellipse = TRUE, circle = TRUE) +
scale_color_discrete(name = '') +
geom_point(aes(colour=wine.class), size = 8) +
theme(legend.direction ='horizontal',
legend.position = 'top')
答案 0 :(得分:2)
一种可能性:使用xlim
和ylim
fuctnions
library(ggbiplot)
data(wine)
wine.pca <- prcomp(wine, scale. = TRUE)
p <-
ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, group=wine.class,
varname.size = 8, labels.size=10,
ellipse = TRUE, circle = TRUE) +
scale_color_discrete(name = '') +
geom_point(aes(colour=wine.class), size = 8) +
theme(legend.direction ='horizontal',
legend.position = 'top')
p <- p + xlim(-6, 6) + ylim(-6, 6)
print(p)