Re: [R] barchart() {lattice} help.

2009-12-08 Thread Deepayan Sarkar
On Sun, Dec 6, 2009 at 8:53 AM, Peng Cai wrote: > Please ignore my last question. I found a way to handle that. One last > thing: > > I'm defining my own y scales. In the process the bar starts from below the > "y=0" line (or below the y-axis). Is there a way to get rid of it. Have you tried addi

Re: [R] barchart() {lattice} help.

2009-12-06 Thread Peng Cai
Please ignore my last question. I found a way to handle that. One last thing: I'm defining my own y scales. In the process the bar starts from below the "y=0" line (or below the y-axis). Is there a way to get rid of it. Here is the code and data I'm using R Code (Data read in object "dta") dta$

Re: [R] barchart() {lattice} help.

2009-12-06 Thread Peng Cai
Thank you Uwe, Dennis, and Gary for your help. I have one more question: I'm using pre-defined y-scales and trying to create grid lines. As "Female" category has low sum value, its y-axis range from 0-150 whereas "Male" ranges from 0-300. Is it possible to make them on same scale. Here is the pre

Re: [R] barchart() {lattice} help.

2009-12-06 Thread Gary Miller
Thanks Uwe, I got your suggestions part too. 2009/12/6 Uwe Ligges > > > Peng Cai wrote: > >> Hi, >> >> I'm plotting grouped barplot using following code and data. I need help >> with >> re-ordering the labels. >> >> 1. On x-axis the factor "AGE" is grouped in order "0--4", "15--18", >> "5--14";

Re: [R] barchart() {lattice} help.

2009-12-06 Thread Uwe Ligges
Peng Cai wrote: Hi, I'm plotting grouped barplot using following code and data. I need help with re-ordering the labels. 1. On x-axis the factor "AGE" is grouped in order "0--4", "15--18", "5--14"; whereas I would like to have it in "0--4", "5--14", "15--18". 2. If I need to re-order "RACE"

Re: [R] barchart() {Lattice} help.

2009-11-27 Thread Deepayan Sarkar
On Fri, Nov 27, 2009 at 9:21 AM, Peng Cai wrote: > @ Peter: I got it, thanks a lot for all your help! And yes, as you said the > "title" option in auto.key is redundant. > > > @ All, Hi: I need to add percentage sign to y-axis labels (like 0%, 20%, > ..., 100%). How can I get it. I'm using barchar

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
@ Peter: I got it, thanks a lot for all your help! And yes, as you said the "title" option in auto.key is redundant. @ All, Hi: I need to add percentage sign to y-axis labels (like 0%, 20%, ..., 100%). How can I get it. I'm using barchart() function as given below along with the data set. Data:

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread P Ehlers
As I wrote earlier: "I had to add the rectangles= and points= arguments to auto.key to get the same key as you had earlier." and the relevant line in the code was: auto.key = list(space = 'right', rectangles=TRUE, points=FALSE) -Peter Ehlers Peng Cai wrote: Hello Peter and David, Thanks f

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius
On Nov 26, 2009, at 8:30 PM, Peng Cai wrote: > Hello Peter and David, > > Thanks for your help. I have added what you suggested and its > working perfectly fine except: > > When I add the panel function, the legend changes. In the sense > without the panel function the column names are shown

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Hello Peter and David, Thanks for your help. I have added what you suggested and its working perfectly fine except: When I add the panel function, the legend changes. In the sense without the panel function the column names are shown with small colored rectangles (on right), but after adding it t

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers
Peng, Did you try the code I sent? If not, why not? If you want equally spaced grid lines, use panel.grid() in place of panel.abline(). BTW, I don't understand what that "title=..." stuff in your auto.key() call is supposed to do. I think it just results in title=NULL. -Peter Ehlers Peng Cai

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius
I do not see that you have used any panel functions. Even if you did not review the help from ?barchart, where there are several examples of using panel functions, I would have expected that you would look carefully at Peter Ehlers' code and try to apply it. -- David. On Nov 26, 2009, at

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Currently I'm trying and I'm looking to draw lines y=-3, y=-2,..., y=8: Data: Sample Col1 Col2 Col3 Row1 -2 4 -1 Row2 3 -2 4 Row3 3 5 -2 Row4 4 1 -1 Code: library(lattice) dta<-read.table("data.txt", header=TRUE, row.names="Sample") coltemp=c(619,376,497,598,124,92,402) myYscale <- seq(-10, 10, 1

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Hi Again, Before I start getting into what you just suggested, let me confirm if I made my point clear previously. I'm looking for horizontal lines similar to one on the following link (It has parallel lines for each y=200, y=400,...): http://pfiles.5min.com/images/176735/176734313.jpg What you

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius
Cannot reproduce. Seems to work as documented. Maybe your code (whatever it might be) is not correct? -- David. On Nov 26, 2009, at 6:53 PM, Peng Cai wrote: Thanks David, I tried panel.abline(h=somevalue) -- both inside and outside of barchart() function but its not working. Any suggestions

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers
Peng Cai wrote: Thanks David, I tried panel.abline(h=somevalue) -- both inside and outside of barchart() function but its not working. Any suggestions? Peng Here's some code related to the data you posted earlier. barchart(data.matrix(dta), horizontal = FALSE, stack = TRUE, par.se

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks David, I tried panel.abline(h=somevalue) -- both inside and outside of barchart() function but its not working. Any suggestions? Peng On Thu, Nov 26, 2009 at 6:42 PM, David Winsemius wrote: > > On Nov 26, 2009, at 6:12 PM, Peng Cai wrote: > > Thanks a lot Peter! One more help, is there a

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius
On Nov 26, 2009, at 6:12 PM, Peng Cai wrote: Thanks a lot Peter! One more help, is there a similar function abline() for barchart(). ?panel.abline I'm trying to add a (light gray colored) horizontal lines, one for each y-value. Peng On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers w

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks a lot Peter! One more help, is there a similar function abline() for barchart(). I'm trying to add a (light gray colored) horizontal lines, one for each y-value. Peng On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers wrote: > Peng Cai wrote: > >> Hi Peter, >> >> I'm not sure but it seems "s

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers
Peng Cai wrote: Hi Peter, I'm not sure but it seems "scales" command works only with integer values. If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0, 0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But I need it to extend it to negative numbers and reduce

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Hi Peter, I'm not sure but it seems "scales" command works only with integer values. If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0, 0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But I need it to extend it to negative numbers and reduce the scale width (

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks Peter and Dennis for your help! On Thu, Nov 26, 2009 at 3:50 PM, Dennis Murphy wrote: > Hi: > > In addition to Peter's suggestions, I would suggest that you get rid of the > row names as the > first column of your data frame, as it confuses barchart (and the > interpretation of the plot).

Re: [R] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers
Peng Cai wrote: Hi R Users, I'm trying to plot a stacked barplot. Here is data: Sample Col1 Col2 Col3 Row1 -2 4 -1 Row2 3 -2 4 Row3 3 5 -2 Row4 4 1 -1 I'm using following R code: library(lattice) dta<-read.table("data.txt", header=TRUE, row.names="Sample") barchart(data.matrix(dta),