2012-07-23 5 views
13

geom_text를 사용하여 인쇄 된 텍스트가 명확하지 않습니다. 어떻게하면 더 명확하게 할 수 있습니까?ggplot : geom_text로 인쇄 된 텍스트가 분명하지 않습니다.

data = data.frame(rnorm(1000)) 
colnames(data) = "numOfX" 
m <- ggplot(data, aes(x=numOfX)) 
m + geom_histogram(colour = "blue", fill = "white", binwidth = 0.5) + 
    annotate("segment", x=10,xend=10,y=20,yend=0,arrow=arrow(), color="blue") + 
    geom_text(aes(10, 30, label="Observed \n value"), color = "blue") 

enter image description here

+0

가능한 중복 [ggplot2 : 톱니, 가난한 품질에 대한 수정이 있는가 geom_text()에 의해 생성 된 텍스트?] (http://stackoverflow.com/questions/10952832/ggplot2-is-there-a-fix-for-jagged-poor-quality-text-produced-by-geom-text) –

+0

이것을 쉽게 해결할 수있는 방법은'geom_text'에서'check_overlap = TRUE' 인수를 사용하는 것입니다. –

답변

21

텍스트의 사용 annotate뿐만 아니라 화살표 :

m + geom_histogram(colour = "blue", fill = "white", binwidth = 0.5) + 
    annotate("segment", x=10,xend=10,y=20,yend=0,arrow=arrow(), color="blue") + 
    annotate("text", x=10, y=30, label="Observed \n value", color = "blue") 

enter image description here


이유는 geom_text은 각 행의 텍스트를 overplots이다 데이터 프레임의 데이터, whe reas annotate은 텍스트를 한 번만 플롯합니다. 대담하고 픽셀 화 된 텍스트를 만드는 것은이 overplotting입니다.

이 질문에 대한 답변이 최근에 올랐습니다. 내가 참조를 찾을하려고합니다 : 비슷한 질문은 최근에 질문을 받았다 :

관련 문제