[R] Bar plot

Peter Ehlers ehlers at ucalgary.ca
Tue Feb 9 18:52:29 CET 2010


Here is a simple 3-step solution:

1. type ?barplot
2. find the section labelled 'Arguments'
3. carefully read what each argument means/does

Voila, problem(s) solved.

(It was good to include some data, but not so good
to say that title(...) is giving "an error". No need
to be secretive about the error; just say what it was.)

  -Peter Ehlers

Sunitap22 wrote:
> Hello 
> 
> (this might be a very simple question) 
> My data is as follows (table name is student)
>    Year    StudentsPassed
> 1  2000    300
> 2  2001    360
> 3  2002    450
> 4  2003    450
> 5  2004    270
> 6  2005    280
> 7  2006    400
> 8  2007    270
> 
> I want to plot a barplot so for this 
> 
> If I use barplot(students) it says "Error in barplot.default(students) :
> 'height' must be a vector or a matrix"
> 
> so I used the following command
> barplot(StudentsPassed)
> 
> But this doesnt give me the names for Xaxis, how can I get the names for
> Xaxis, also how can I get labels for X and Y axis, and tittle, I tried 
> 
> title(main = "Year Vs Number of Publications")
> to get the title but its giving me an error
> 
> Thanks in advance
> Sunita
> I want to 

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list