[R] several functions in the same plot

Liaw, Andy andy_liaw at merck.com
Mon Nov 18 14:01:25 CET 2002


If the functions are all evaluated at the same set of x values, then you can
use something like:

matplot(x, cbind(fx, gx, hx), type="l")

where fx, gx and hx are the function values.  The advantage of this over
plot() followed by lines() is that the limits on y-axis automatically
account for all three functions.

HTH,
Andy

-----Original Message-----
From: demolombe [mailto:demolomb at ensam.inra.fr]
Sent: Monday, November 18, 2002 4:56 AM
To: r-help at stat.math.ethz.ch
Subject: [R] several functions in the same plot


Hello,
Is it possible to plot several functions on a same plot? 
example: 3 functions : f(x), g(x), h(x) 
I would like to obtain one graphic with x-axis and y-axis 
and the 3 functions plotted to compare them.
Vincent


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list