Hi there,
Perhaps:
set.seed(122)
x=1:50
y1=2*x+x^2
y2=x^2
plot(x,y1,ylim=range(y1,y2),type='l',ylab=expression(f(x)),xlab='x',
main='Two superimposed graphs')
points(x,y2,type='l',col=2)
legend("topleft",c(expression(f(x)==2*x+x^2),expression(f(x)==x^2)),lty=1,col=1:2)
Also you could check ?curve and ?lines.
HTH,
Jorge
On Sun, May 18, 2008 at 1:18 PM, hanen <hanen.mastouri@yahoo.fr> wrote:
>
> Hio
>
> i tried to do this by:
> par(new=TRUE)
>
> but the result is one picture but y-axis has 2 différent graduations.how
> can
> i correct this?( i want one graduation on y axis).
> --
> View this message in context:
>
http://www.nabble.com/how-can-i-superpose-2--graphs-tp17305355p17305355.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]