1
로딩 레이블의 위치를 조정하여 화살표 꼭대기에 떨어지지 않게하고 싶습니다. 그러나 나는 조정이 필요한 곳을 모른다. geom_text
은 사이트 위치의 위치를 조정하는 데 사용할 수 있지만 벡터가 저장되는 위치는 str(g)
입니다.autoplot - 라벨로드 조절 방법은 무엇입니까?
library(ggplot2)
library(ggfortify)
df <- data.frame(replicate(10,sample(-10:10,10,rep=TRUE)))
names(df) <- c('up','down','left','right','circle','square','triangle','x','r1','l1')
rownames(df) <- paste('Dummy Site', seq(0,9,1))
g <- autoplot(prcomp(df[,-11], scale=TRUE), data=df,
loadings.label=TRUE, loadings=TRUE,
loadings.label.size=8, loadings.colour='blue',
label.size=5) +
geom_text(vjust=-1, label=rownames(df)) +
theme(plot.background=element_blank(),
panel.background=element_rect(fill='transparent',color='black',size=1),
legend.text=element_text(hjust=1),
legend.key=element_blank())
g
나는 ggplot2::theme
에서 살펴본 autoplot
에 대한 도움말 문서를 검토했지만, 조정 라벨 위치에 대한 언급을 찾을 수 없습니다. 화살표의 벡터에 따라 조정할 수 있다면 보너스 포인트이지만 정적 조정은 허용됩니다. 당신은 layer_data(g, 2)
에 의해 좌표를 얻을 수 있습니다