Re: [R] plotting with same axes

From: Marc Schwartz (via MN) <>
Date: Tue 23 Aug 2005 - 03:11:43 EST

On Mon, 2005-08-22 at 12:58 -0400, wrote:
> I have used the 'par' command to
> overlay one plot on another. But how
> do I overlay it with the x-values
> plotted at the same points on the
> x-axis?
> Thank you,
> Steven

The specific answer depends to an extent on the graphics you are plotting and whether there is a need to actually use par("new").

In some cases there is an 'add = TRUE' option to plotting functions that allows for this.

In others, you can create the initial plot and then use lines(), points() or the like to simply add further plotting components to the existing plot.

If all else fails and you need to use par("new"), then you will want to explicitly define the x and y axes to the same ranges by using the same 'xlim' and 'ylim' arguments in _both_ plotting functions.

A reproducible example of what it is you are doing would enable us to give you more specific guidance, if the above is not helpful.

HTH, Marc Schwartz mailing list PLEASE do read the posting guide! Received on Tue Aug 23 03:21:41 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:41:21 EST