2017-09-04 1 views
0

제 3 자 라이브러리의 기본 "ge"_ * 레이어를 "stat"속성과 결합 할 수 있습니까? 그리고 다른 라이브러리의 기하 구조를 가진 기본 ggplot stat_ * 레이어. 내가 ggrepel 패키지에서 타사 "geom_text_repel"와 "텍스트"기하 구조를 교체하려면이 예에서확장 라이브러리와 결합 된 ggplot2

require(ggrepel)  
Plot1<- ggplot(data=mpg, aes(x=cty, y=hwy)) + 
    geom_point()+ 
    stat_sum(aes(label=..n..), alpha=.5, colour=c("red"), size=3, geom="text") 

:

나는 간단한 예제가 있습니다. 경우에 내가 속성 기하 구조 = "텍스트"로 변경 = "text_repel을"기하 구조, 오류 메시지가 나타납니다

Error: Found object is not a geom.

비슷한 오류가 나는 ggplot2의 geom_의 * 층 제 3 자 통계를 사용하고자하는 경우에 나타납니다.

이 오류를 해결하는 방법?

답변

1

이 코드는 내 R 3.4.1 (ggplot2_2.2.1.9000ggrepel_0.6.5)에서 작동 :

library(ggplot2) 
library(ggrepel)  
Plot1 <- ggplot(data=mpg, aes(x=cty, y=hwy)) + 
    geom_point() + 
    stat_sum(aes(label=..n..), alpha=.5, colour=c("red"), size=3, geom="text_repel") 
Plot1 

enter image description here