2009-02-18 111 views
2

我已經裝箱,看起來像這樣的數據:排序在barplot X軸

(8.048,18.05] (-21.95,-11.95] (-31.95,-21.95] (18.05,28.05] (-41.95,-31.95] 
      81    76    18    18    12 
    (-132,-122]  (-122,-112]  (-112,-102]  (-162,-152] (-102,-91.95] 
       6    6    6    5    5 
(-91.95,-81.95]  (-192,-182] (28.05,38.05] (38.05,48.05] (58.05,68.05] 
       5    4    4    4    4 
    (78.05,88.05]  (98.05,108]  (-562,-552]  (-512,-502] (-482,-472] 
       4    4    3    3    3 
    (-452,-442]  (-412,-402]  (-282,-272]  (-152,-142] (48.05,58.05] 
       3    3    3    3    3 
    (68.05,78.05]  (118,128]  (128,138]  (-582,-572] (-552,-542] 
       3    3    3    2    2 
    (-532,-522]  (-422,-412]  (-392,-382]  (-362,-352] (-262,-252] 
       2    2    2    2    2 
    (-252,-242]  (-142,-132] (-81.95,-71.95]  (148,158] (-1402,-1392] 
       2    2    2    2    1 
    (-1372,-1362] (-1342,-1332]  (-942,-932]  (-862,-852] (-822,-812] 
       1    1    1    1    1 
    (-712,-702]  (-682,-672]  (-672,-662]  (-632,-622] (-542,-532] 
       1    1    1    1    1 
    (-502,-492]  (-492,-482]  (-472,-462]  (-462,-452] (-442,-432] 
       1    1    1    1    1 
    (-432,-422]  (-352,-342]  (-332,-322]  (-312,-302] (-302,-292] 
       1    1    1    1    1 
    (-202,-192]  (-182,-172]  (-172,-162] (-51.95,-41.95] (88.05,98.05] 
       1    1    1    1    1 
     (108,118]  (158,168]  (168,178]  (178,188]  (298,308] 
       1    1    1    1    1 
     (318,328]  (328,338]  (338,348]  (368,378]  (458,468] 
       1    1    1    1    1 

我如何可以繪製這個數據,以使箱從最消極的分類在左邊最積極的右側?目前我的圖形看起來像是like this。注意它根本沒有排序。特別是第二條(value = 76)被放置在第一個的右邊:

(8.048,18.05] (-21.95,-11.95] 
      81    76 

這是我用圖的命令:

barplot(x,ylab="Number of Unique Tags", xlab="Expected - Observed") 
+0

@Kev:感謝您的貢獻並開始了回滾戰爭,您的濫用行爲已得到充分注意。 – GEOCHET 2009-03-05 17:58:56

+0

@Rich B:「虐待」? 「正式註明」? – 2009-03-05 18:31:16

回答

5

我真的想幫助回答你的問題,但我必須告訴你,我無法正確理解你的數據。我看到很多左括號但沒有關閉。數據看起來按照每行底部的值降序排序。我不知道該怎麼做出來的值等的「(8.048,18.05]」

我失去了一些東西明顯?你能更簡單的例子,其中數據結構是不是一個因素?

我一般會期望一個數據幀或兩列,一個X和一個用於Y.

看看排序的這個例子可以幫助(我在黑暗中那種這裏取景)

tN <- table(Ni <- rpois(100, lambda=5)) 
r <- barplot(tN) 

#stop here and examine the plot 
#the next bit converts the matrix to a data frame, 
# sorts it, and plots it again 

df<-data.frame(tN) 
df2<-df[order(df$Freq),] 
barplot(df2$Freq) 
矩陣