breaks
おそらく、次の引数を探しているでしょうgeom_histogram
:
# create some fake data
id <- sample(1:100000, 10000, rep=T)
visits <- sample(1:1200,10000, rep=T)
#merge to create a dataframe
df <- data.frame(cbind(id,visits))
#plot the data
require(ggplot2)
ggplot(df, aes(x=visits)) +
geom_histogram(breaks=c(seq(0, 200, by=10), max(visits)), position = "identity") +
coord_cartesian(xlim=c(0,210))
これは次のようになります (ここでは偽のデータがかなり悪く見え、ブレークに一致するように軸も調整する必要があることに注意してください):

編集:
たぶん、他の誰かがここで検討することができます:
# create breaks and labels
brks <- c(seq(0, 200, by=10), max(visits))
lbls <- c(as.character(seq(0, 190, by=10)), "200+", "")
# true
length(brks)==length(lbls)
# hmmm
ggplot(df, aes(x=visits)) +
geom_histogram(breaks=brks, position = "identity") +
coord_cartesian(xlim=c(0,220)) +
scale_x_continuous(labels=lbls)
プロット エラー:
Error in scale_labels.continuous(scale) :
Breaks and labels are different lengths
このように見えますが、8 か月前に修正されました。