On 03/24/2011 03:26 AM, blutack wrote:
How do you do a bar chart of 2 vectors?
I have one vector which has 10 numbers, and another which has 10 names.
The numbers are the frequency of the corresponding name, but when I do a bar
chart it says that there is no height. Thanks.
Hi blutack (any relation to Bluto?),
My guess is that you want the frequencies as the heights of the bars and
the names as the labels of the bars:
heights<-sample(10:30,10)
bar_names<-c("Oliver","Petroushka","Queequag","Rumplestiltskin",
"Sinbad","Tycho","Uranus","Vesalius","Wojtec","Xavier")
barplot(heights,names.arg=bar_names)
Whoops! Lost some of the labels:
library(plotrix)
barp(heights,names.arg=bar_names,staxx=TRUE)
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.