Re: [R] how to add a line in the graph?

2013-12-16 Thread David Winsemius
On Dec 15, 2013, at 4:46 AM, 水静流深 wrote: t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l) how can i add a curve y=0.83*t-0.44*t^2 in the graph? [[alternative HTML version deleted]] t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l, ylim=c(-4,16)) curve( 0.83*x-0.44*x^2 ,

[R] how to add a line in the graph?

2013-12-15 Thread ????????
t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l) how can i add a curve y=0.83*t-0.44*t^2 in the graph? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] how to add a line in the graph?

2013-12-15 Thread Frans Marcelissen
Hi, On itself one way of doing this is: lines(seq(-4,4,0.1),sapply(seq(-4,4,0.1),function(t)0.83*t-0.44*t^2)) The curve does not fit in the scale, however. Are you sure the formula is correct? Then you have to adapt the scale: plot.new() plot.window(xlim=c(-4,4), ylim=c(-10,16)) axis(1) axis(2)