Gundala Viswanath wrote:
...
How do you do that? Yes I am using that data exactly for the plotting.

Say you have this data frame (I'm too lazy to type in your example):

testdat<-cut(rnorm(100,3),breaks=0:6)

get a table:

testtable<-table(testdat)

testtable
(0,1] (1,2] (2,3] (3,4] (4,5] (5,6]
   3     6    38    34    17     2

now mess up the order of the table:

testtable<-testtable[sample(1:6,6)]
testtable
(4,5] (5,6] (2,3] (3,4] (0,1] (1,2]
  17     2    38    34     3     6

If you send this to barplot, you will get the bars in the new order of the table elements. If you sort the unsorted table and then send it to barplot:

testtable<-testtable[sort(names(testtable))]

You should get what you want.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to