[R] print formula on plot

From: Thomas Steiner <finbref.2006_at_gmail.com>
Date: Thu 09 Feb 2006 - 00:47:13 EST


I estimate some parameters and I want to print them (pretty) on my plot:

# somehow estimated parameters

z<-c(1.543523e+00, 1.23453e+00, 3.454000e+00)

x<-seq(-1,1,length=100)
plot(x,z[3]*x^2+z[2]*x+z[3],type="l", main="My nice plot of the estimated function")
zs<-format(z,digits=4,scientific=FALSE,trim=TRUE)

text(-0.9,7,expression(1.54*x^2))                   # is what I want,
but DYNAMIC
text(-0.9,6,expression(paste(zf[1],x^3)))         # not really
text(-0.9,5,expression(paste(toSting(zf[1]),x^3))) # not really
#using z (double) instead of zf (string) does not help.

So my question is:
How do I evaluate zf[1] from the variable to it's (String) value? Here it is used within an expression: this makes all the trouble.

Thanks for help, I tried 2 hrs now...
Thomas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 09 01:16:09 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:26 EST