0
在Minitab中,很容易創建「分割點」直方圖。這可以在ggplot2
完成嗎?ggplot2中的分界點直方圖
例如,
df <- data.frame(x = c(0.08, 0.21, 0.25, 0.4, 0.5, 0.6))
ggplot(df, aes(x = x)) + geom_histogram(binwidth = 0.1)
正如你可以在這裏看到,R
默認爲 「中點」 直方圖。包含0.08
的酒吧在0.1
處標有酒吧。包含0.21
和0.25
的欄正在標記爲0.2
等等。
我可以以某種方式改變這些酒吧因此第一條涵蓋0
和0.1
之間的區域,而第二條涵蓋0.2
和0.3
,等等之間的區域?
不知道你想要輸出什麼,但這樣做嗎? 'ggplot(df,aes(x = x))+ geom_histogram(breaks = seq(0,max(df $ x),by = 0.1))' –
邊界參數也應該在這裏: 'ggplot(df,aes (x = x))+ geom_histogram(binwidth = 0.2,boundary = 1)' – pHroc