Elizabeth Webb
2008-Jun-26 12:55 UTC
[R] Gettting barchart titles as numbers not characters
Hi, I wonder if you could help me with my barcharts, I am using the barchart function from the lattice library. I have data like this: Complex,Organisms,Percentage 130,0,50 130,1,10 130,2,20 130,3,15 130,4,5 133,0,10 133,1,15 133,2,20 133,3,50 133,4,5 I draw barcharts using this command... barchart(Percentage~Organisms|Complex,data=data,layout=c(1,2),col=rainbow(5),box.ratio=3,horizontal=FALSE,xlim=c(" 0 "," 1 "," 2 "," 3 "," 4 "),ylim=c(1,100),xlab="") But I can't get the title for each graph with the titles "130" and "133". The same was for the xlim, so I cheated by using spaces so it thinks it is a character string not a number. If you know the proper way to do this, that would be great to know too. One last thing, the title comes up in a pink row above each barchart - any way to make this look a little more exciting? i.e. change colour, align to the left?? Many thanks Liz
try: barchart(Percentage~Organisms|factor(Complex),data=data,layout=c(1,2),col=rainbow(5),box.ratio=3,horizontal=FALSE,xlim=c(" 0 "," 1 "," 2 "," 3 "," 4 "),ylim=c(1,100),xlab="") On Thu, Jun 26, 2008 at 8:55 AM, Elizabeth Webb <e.c.webb97 at leeds.ac.uk> wrote:> Hi, I wonder if you could help me with my barcharts, I am using the barchart > function from the lattice library. > > I have data like this: > Complex,Organisms,Percentage > 130,0,50 > 130,1,10 > 130,2,20 > 130,3,15 > 130,4,5 > 133,0,10 > 133,1,15 > 133,2,20 > 133,3,50 > 133,4,5 > > I draw barcharts using this command... > barchart(Percentage~Organisms|Complex,data=data,layout=c(1,2),col=rainbow(5),box.ratio=3,horizontal=FALSE,xlim=c(" > 0 "," 1 "," 2 "," 3 "," 4 "),ylim=c(1,100),xlab="") > > But I can't get the title for each graph with the titles "130" and "133". > The same was for the xlim, so I cheated by using spaces so it thinks it is a > character string not a number. If you know the proper way to do this, that > would be great to know too. One last thing, the title comes up in a pink row > above each barchart - any way to make this look a little more exciting? i.e. > change colour, align to the left?? > > Many thanks > > Liz > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?