[R] Change the scale on a barplot's y axis
Thomas Levine
thomas.levine at gmail.com
Sun Feb 28 01:44:29 CET 2010
I have grades data. I read them from a csv in letter-grade format. I
then converted them to levels
levels(grades$grade)=c('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-')
And then to numbers
grades$gp=grades$grade
levels(grades$gp)=c(4.3,4.0,3.7, 3.3,3.0,2.7, 2.3,2.0,1.7, 1.3,1.0,0.7)
grades$gp=as.numeric(as.character(grades$gp))
And I'm plotting them in a barplot
barplot(gp[order(gp)],width=n[order(gp)],ylab="Class Median
Grade",xlab="Class, scaled to number of students in the
class",main="Class Median Grades for Cornell University weighted by
class size")
I would like to change the scale on the bar graph such that it reads
c('A+','A','A-','B+','B','B-','C+','C','C-','D+','D','D-')
in the locations
c(4.3,4.0,3.7, 3.3,3.0,2.7, 2.3,2.0,1.7, 1.3,1.0,0.7)
Any ideas?
Tom
More information about the R-help
mailing list