[R] need help with barplot
Hello, I do this a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) b=matrix(a,nrow=4) rownames(b)=c(20/04/2002,21/04/2002,22/04/2002,23/04/2002) colnames(b)=c(p1,p2,p3) barplot(b,beside=T,col=(c(red,orange,yellow))) then I have http://www.mif.vu.lt/~roka5178/barplot1.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot1.JPG but I need to have http://www.mif.vu.lt/~roka5178/barplot.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot.JPG how can i do this? i need to to change axis x whit y -- Robertas [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] need help with barplot
You need the transpose of the matrix (or create it differently in the first place!). Changing the last line to barplot(t(b),beside=T,col=(c(red,orange,yellow))) should do the trick. On 29/11/06, Robertas Kavaliūnas [EMAIL PROTECTED] wrote: Hello, I do this a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) b=matrix(a,nrow=4) rownames(b)=c(20/04/2002,21/04/2002,22/04/2002,23/04/2002) colnames(b)=c(p1,p2,p3) barplot(b,beside=T,col=(c(red,orange,yellow))) then I have http://www.mif.vu.lt/~roka5178/barplot1.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot1.JPG but I need to have http://www.mif.vu.lt/~roka5178/barplot.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot.JPG how can i do this? i need to to change axis x whit y -- Robertas [[alternative HTML version deleted]] __ R-help@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 and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] need help with barplot
--- Robertas Kavaliûnas [EMAIL PROTECTED] wrote: Hello, I do this a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) b=matrix(a,nrow=4) rownames(b)=c(20/04/2002,21/04/2002,22/04/2002,23/04/2002) colnames(b)=c(p1,p2,p3) barplot(b,beside=T,col=(c(red,orange,yellow))) then I have http://www.mif.vu.lt/~roka5178/barplot1.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot1.JPG but I need to have http://www.mif.vu.lt/~roka5178/barplot.JPGhttp://www.mif.vu.lt/%7Eroka5178/barplot.JPG how can i do this? i need to to change axis x whit y Robertas This is dirty code but it works. Just transpose the matrix before you plot it. a=c(10.2,0.4,0.2,5.2,8.6,1.6,0.0,1.0,6.3,1.4,0.4,0.2) b= matrix(a,nrow=4) rownames(b)=c(20/04/2002,21/04/2002,22/04/2002,23/04/2002) colnames(b)=c(p1,p2,p3) b1 - t(b)# Transpose of 'b' barplot(b1,beside=T,col=(c(red,orange,yellow))) __ R-help@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 and provide commented, minimal, self-contained, reproducible code.