2012-08-16 4 views
2

올바른 히스토그램을 얻기 위해 약간의 시간이 필요합니다. 나는 각 bin을 1-5, 5-10, 10-15 등의 값으로하고 싶습니다. 그러나 stat_bin을 사용하면 범위는/30 기본값으로 되돌아갑니다.stat_bin이 기본값으로 되 돌림

ggplot(tmp,aes(x = values)) + 
+  facet_wrap(~ind) + 
+  geom_histogram(aes(y=..count../sum(..count..)),stat="bin")+ 
+  scale_x_continuous("Percent above 30x")+ 
+  scale_y_continuous("Fraction of panel")+ 
+  opts(title = yz)+ 
+  stat_bin(bandwidth=5.0) 
stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this. 

내가 읽고있는 동안 내가 이해하지 못했던 어리석은 구문 일 가능성이 높습니다. 나는 왜 이것이 일어나고 있는지 누군가가 조언 할 수 있기를 바랬다.

+0

질문에 답변을 추가하지 마십시오. 귀하의 답변을 제거하고 답변으로 게시하겠습니다. – Andrie

답변

1

OP가이 솔루션을 게시했습니다. geombinwidth=5 인수를 추가하십시오.

ggplot(tmp,aes(x = values)) + 
    facet_wrap(~ind) + 
    geom_histogram(aes(y=..count../sum(..count..)), binwidth=5)+ 
    scale_x_continuous("Percent above 30x")+ 
    scale_y_continuous("Fraction of panel")+ 
    opts(title = yz) 
+0

감사합니다. 나는 8 시간 후 또는 무언가가 끝날 때까지 내 자신의 질문에 대답하기에 충분한 담당자가 없다. – Stephopolis

+0

@user 만료 후 자신의 답변을 게시하고 싶다면 알려주고이 대답을 삭제하겠습니다. (이 답변에 댓글을 추가하기 만하면 알립니다.) – Andrie

관련 문제