[R] Plotting 3 vectors on one graph.

jim holtman jholtman at gmail.com
Sat Feb 2 13:56:20 CET 2008


What you want to do is to use 'plot' for the initial vector and then
"lines" to add the other two.  You will have to set the range of the
y-axis in the initial call to "plot".  The sequence would probably
look like this:

plot(a, ylim=range(a, b, c), col='black')
lines(b, col='red')
lines(c, col='green')

On Feb 1, 2008 7:06 PM, cvandy <cvandy26 at gmail.com> wrote:
>
> I'm an R newbie and am trying to plot 3 vectors, say a,b,c.  I have
> downloaded 3 R manuals and searched your forum.  There are plenty of X vs Y
> examples, but cannot find how to plot 3, or more vectors one one graph.  I'm
> sure I overlooked something.
> Thanks for any help.
> CHV
> --
> View this message in context: http://www.nabble.com/Plotting-3-vectors-on-one-graph.-tp15236552p15236552.html
> Sent from the R help mailing list archive at Nabble.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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list