Re: [R] Plotting functions on the same figure

From: Peter Dalgaard <>
Date: Sat 21 May 2005 - 23:19:26 EST

Volkan Kumbasar <> writes:

> Hi there,
> i am a newbie :P
> My simple question is:
> Is there command which is equal of the m*tl*abs `hold on` command.
> In other words i want to plot 5 functions in the same figure.

I wouldn't know exactly what `hold on` does. If you are plotting functions using curve(), notice that you can set add=TRUE (but you do have to get the xlim and ylim right on the first graph).

Otherwise, matplot() with type="l" could be the ticket. Or plot() followed by lines().

The most drastic measure - and usually the wrong idea - is to set par( to make the next plot believe that it doesn't need to clear the screen (or advance the page as the case may be). Obviously, you need to careful that the axes and titles are the same, or suffer the consequences...

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (             FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Sat May 21 23:23:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:59 EST