[R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-21 Thread Bryan Hanson
Hi All. I have the commands below to create a stripchart/plot. I was hoping to color the points in the plot by yr, and use a symbol that varied with resp. However, the outcome makes it appear as though the point by point col and pch data is not being passed properly. Any suggestions? And truthf

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Bryan Hanson
Below is a revised set of code that demonstrates my question a little more clearly, I hope. When plotting all the data (5th panel), col & sym don't seem to be passed correctly, as the (random) first value for col & sym are used for all points (run the code, then run it again, you'll see how the 5t

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Gabor Grothendieck
Try this: library(lattice) all$resp <- as.factor(all$resp) stripplot(~ index | resp * yr, all, col = all$col, pch = all$sym, layout = c(1, 4)) On Sun, Jun 22, 2008 at 10:43 AM, Bryan Hanson <[EMAIL PROTECTED]> wrote: > Below is a revised set of code that demonstrates my question a little more >

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Gabor Grothendieck
Actually I am not sure if my prior answer was correct. I think its ok with one panel but you might have to use a panel function is there are several. With one panel it seems ok: stripplot(~ index, all, col = all$col, pch = all$sym) On Sun, Jun 22, 2008 at 12:28 PM, Gabor Grothendieck <[EMAIL PRO

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Bryan Hanson
Thanks Gabor, I'm getting closer. Is there a way to spread out resp values vertically for a given value of index? In base graphics, stripchart does this with method = "stack". But in lattice, stack = TRUE does something rather different, and I don't see a combination of lattice arguments that do

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-22 Thread Gabor Grothendieck
I tried it with a simple example to make it easier to check the result and it does seem we need a panel function, pnl: library(lattice) DF <- data.frame(x = 1:5, col = c(1:4, 1), g = c(1, 1, 2, 2, 2), pch = c(1:3, 2:1)) pnl <- function(x, y, subscripts, col, pch, ...) panel.stripplot(x, y, col = c

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-23 Thread Deepayan Sarkar
On 6/22/08, Bryan Hanson <[EMAIL PROTECTED]> wrote: > Thanks Gabor, I'm getting closer. > > Is there a way to spread out resp values vertically for a given value of > index? In base graphics, stripchart does this with method = "stack". But > in lattice, stack = TRUE does something rather diffe

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-23 Thread Bryan Hanson
Thanks Deepayan. That's the conclusion I have gradually reaching! Bryan On 6/23/08 5:57 PM, "Deepayan Sarkar" <[EMAIL PROTECTED]> wrote: > On 6/22/08, Bryan Hanson <[EMAIL PROTECTED]> wrote: >> Thanks Gabor, I'm getting closer. >> >> Is there a way to spread out resp values vertically for a g

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-24 Thread Bryan Hanson
If anyone remains interested, the solution in base graphics is to modify stripchart.default, the last couple of lines where the coloring of points defaults in a way that depends on groups. In my example, the groups are being handled collectively with the coloring. Code is below. Deepayan has not

Re: [R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-24 Thread Deepayan Sarkar
On 6/24/08, Bryan Hanson <[EMAIL PROTECTED]> wrote: > If anyone remains interested, the solution in base graphics is to modify > stripchart.default, the last couple of lines where the coloring of points > defaults in a way that depends on groups. In my example, the groups are > being handled co