[R] plotting order in a barchart.: two problems

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Apr 22 12:56:28 CEST 2006


John Kane wrote:

> I am new at R and have a simple problem, I think. I
> have a matrix:   
> 
>    [,1]   [,2]  [,3]
> a    .5     2    .4
> b    4     3.4    4
> c    4      4     2
> 
> I want a barchart with the [,1] column plotted as the
> left-most group on a vertical bar chart or as the top
> group on a horizontal chart.  However the plotting
> order is , [,3] [,2] [,1].  


Hmm, works for me in the correct order at once:

  barplot(X, beside = TRUE)

But maybe you want to show us some reproducible code ...

Uwe Ligges


> I also am having a problem getting the rows to plot on
> a vertical chart in the order : a , b, c .  I achieved
> this in a horizontal chart by doing a cbind(c,b,a) but
> for some reason I do not seem to be getting this to
> work for the vertical chart.  
> 
> Nothing in Sort() or Order() seem particularly
> appropriate ( or I don't understand what the help is
> telling me).  
> 
> Any suggestions would be appreciated.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list