我的問題與R(3.2.3)中的ggplot2有關。我有4個數據集包含2列和約80,000-100,000行。我用下面的代碼來創建的曲線圖用於一個數據集:使用ggplot2
dataset1 <- read.table("file1.txt", header=T)
ggplot(data=dataset1, aes(dataset1$length))+ geom_histogram (binwidth =500)+
scale_x_continuous(breaks=seq(300,1000,by=200),seq(1001,15000,by=1000))
在此,長度是我的數據集的二路柱,我想有劇情,與x軸示出300-之間的長度1200間隔200(300,500,700,900,1200)和長度1201-1500間隔1000.所以,我用上述代碼scale_x_continuous,但它沒有產生我想要的。你能幫我用這個陰謀的正確的代碼嗎?
下面是數據的簡短的樣本:
case length
C1099757 300
C1099759 300
C1099761 300
C1099763 300
C1100993 301
C1100995 301
C1100997 301
C1100999 301
C1101377 302
C1101379 302
C1101919 303
C1101921 303
C1102979 304
C1102981 304
C1102983 304
C1103475 305
C1103477 305
C1104267 306
C1104269 306
在原始數據文件,它會繼續在12000我張貼的類似的方式。在你看來,ggplot2是適合這種陰謀的,如果不是的話請建議正確的一個。
此外,我正在尋找一種方法來顯示一個圖表中所有4個數據集的長度分佈,以便於比較它們。如果您能請讓我知道我該怎麼做,我將不勝感激。
非常感謝提前。
我下面提供了一個答案。但是,如果您提供了樣本數據(例如使用虹膜),則會更容易。此外你的間隔完成匹配。 – CAFEBABE