Skip to content
Prev 172487 / 398503 Next

Odp: preparing data for barplot()

Hi

Read what barplot does and look to your plot.

If you want each row to be plotted as stacked bar with names uder each bar 
taken from peaople variable then you need to 

transpose your matrix - barplot takes columns
plot without names - you do not want them really plotted
add names under each bar - that is what names.arg is for

barplot(t(data.matrix(fakedata[,-1])), names.arg=fakedata$people)

Regards
Petr

r-help-bounces at r-project.org napsal dne 03.03.2009 19:00:12:
http://www.R-project.org/posting-guide.html