[R] plotting lines and colors
Joshua Wiley
jwiley.psych at gmail.com
Fri Aug 6 18:45:33 CEST 2010
On Fri, Aug 6, 2010 at 9:42 AM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
> Dear R People:
>
> Suppose I plot the following
>
> plot(1:50)
>
> Is there a way to plot, say, [1:25] in red and [26:50] in blue, please?
One simple way is with the col argument, there are certainly fancier
solutions too.
plot(1:50, col = rep(c("red","blue"), each = 25))
Cheers,
Josh
>
> (or should I just plot 2 separate lines, please?)
>
> I'm about 99% sure that there is no way without 2 lines.
>
> thanks for any help,
> Sincerely,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list