Skip to content

plotting with same axes

2 messages · sms13+@pitt.edu, Marc Schwartz (via MN)

#
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
#
On Mon, 2005-08-22 at 12:58 -0400, sms13+ at pitt.edu wrote:
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