[R] Barplot - Can't figure it out

Mulholland, Tom Tom.Mulholland at dpi.wa.gov.au
Fri Feb 18 07:31:59 CET 2005


barplot(matrix(c(x,y),ncol = 2),beside=T)

Does this help 
 
?barplot notes

height: either a vector or matrix of values describing the bars which
          make up the plot.  If 'height' is a vector, the plot consists
          of a sequence of rectangular bars with heights given by the
          values in the vector.  If 'height' is a matrix and 'beside'
          is 'FALSE' then each bar of the plot corresponds to a column
          of 'height', with the values in the column giving the heights
          of stacked "sub-bars" making up the bar.  If 'height' is a
          matrix and 'beside' is 'TRUE', then the values in each column
          are juxtaposed rather than stacked.


> -----Original Message-----
> From: T Petersen [mailto:Terji78 at yahoo.com]
> Sent: Friday, 18 February 2005 1:35 PM
> To: Kevin Wang
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Barplot - Can't figure it out
> 
> 
> Ups, it should of course be barplot() in my mail, not boxplot:-)
> 
> Kevin Wang wrote:
> 
> > Hi,
> >
> > T Petersen wrote:
> >
> >> Hi,
> >>
> >> I have two catagorical vectors like this;
> >>
> >> x = c(1, 2, 4, 2, 1)
> >> y = c(2, 4, 2 ,4, 1)
> >>
> >> I want to set up a barplot with the catagories 1-4 
> horizontally  and 
> >> number of occurances vertically for each vector x,y. I've tried
> >>
> >> boxplot(table(x,y), beside=T)
> >>
> >> and
> >>
> >> boxplot(c(x,y), beside=T)
> >
> >
> > Have you tried barplot(), instead of boxplot()???
> >
> > Cheers,
> >
> > Kev
> >
> 
> ______________________________________________
> 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