Re: [R] assign same legend colors than in the grouped data plot

2012-02-25 Thread R. Michael Weylandt
Your code isn't reproducible...(note the "legend " block -- that's not code) and (if I had to guess) it looks like you are using attach(). Don't do that... What do you mean it doesn't work? You say something about plotting lines, but your "working" code (the first block) doesn't do that... If

Re: [R] assign same legend colors than in the grouped data plot

2012-02-21 Thread agent dunham
Dear all, Thanks all of u for your help. Now I've another similar problem. I want to plot within the same plot, different lines, each one in a different color depending on the factor level. I've been able to do it like this, but if i try with rainbow colors it doesn't work. Can anybody help me wi

Re: [R] assign same legend colors than in the grouped data plot

2012-02-16 Thread Jim Lemon
On 02/16/2012 01:35 AM, agent dunham wrote: Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2,

Re: [R] assign same legend colors than in the grouped data plot

2012-02-15 Thread R. Michael Weylandt
This is certainly not a reproducible example, but this works fine for me. lets = factor(sample(letters[1:3], 10, TRUE)) plot(1:10, 1:10, col = lets) legend("topleft", legend = levels(lets), col = seq.int(length(lets)), lty = 1) Michael On Wed, Feb 15, 2012 at 9:35 AM, agent dunham wrote: > Dear

[R] assign same legend colors than in the grouped data plot

2012-02-15 Thread agent dunham
Dear community, I've plotted data and coloured depending on the factor variable v3. In the legend, I'd like to assign properly the same colors than in the factor (the factor has 5 levels). I've been trying this but it doesn't work. plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , b