[R] Range difference of plot two arrays in one plot
Yuan, Rebecca
rebecca.yuan at bankofamerica.com
Fri Feb 1 19:20:53 CET 2013
Hello David,
When I used the same ylim for both plots, I got what I need:
x = c(0,0,0,10,20,30)
y = c(40,50,60,70,80,90)
plot(x, type='o', ylim=c(min(x,y),max(x,y)))
par(new=T)
plot(y, type='l', ylim=c(min(x,y),max(x,y)))
Thanks,
Rebecca
-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net]
Sent: Friday, February 01, 2013 11:39 AM
To: Yuan, Rebecca
Subject: Re: [R] Range difference of plot two arrays in one plot
On Feb 1, 2013, at 10:28 AM, Yuan, Rebecca wrote:
> Hello all,
>
> When I tried to plot the following two arrays in one figure with the
> following:
>
> x = c(0,0,0,10,20,30)
> y = c(40,50,60,70,80,90)
> plot(x, type='o', ylim=c(min(x),max(x)))
> par(new=T)
> plot(y, type='l', ylim=c(min(y),max(y)))
>
> Found that the first points and last points from those two arrays are
> overlapping together, but the value 30 is not equal to 90. How could I
> draw those two arrays in one plot with their real values shown in the
> plot? i.e., x is in the lower part of the plot and y is in the upper
> part of the plot.
>
Use the same ylim for each plot?
--
David Winsemius, MD
Alameda, CA, USA
----------------------------------------------------------------------
This message, and any attachments, is for the intended r...{{dropped:2}}
More information about the R-help
mailing list