[R] Question about 'text' (add lm summary to a plot)

Gabor Grothendieck ggrothendieck at gmail.com
Sat Jul 23 04:55:04 CEST 2005

If one modifies legend by adding a vfont=c("serif", "plain") argument 
to the call to text (which is within the function text2 that is defined 
within legend) then one can do this:

my.slope.1 <-  "  3.22"
my.slope.2 <-  "0.13"
my.inter.1 <-  "-10.66"
my.inter.2 <-  "1.96"
my.Rsqua <-    "0.97"


tt <- c("Intercept:", "Slope:", "R\\S2:", 
	paste(my.inter.1, "\\+-", my.inter.2),
	paste(my.slope.2, "\\+-", my.slope.2), my.Rsqua)

# modified legend to accept vfont
my.legend("topleft", legend = tt, ncol = 2, adj = 0.1, vfont =
c("serif", "plain"))

which only requires character manipulation -- no plotmath,
expression or bquote; however, unfortunately it still does
not line up.  It undoubtedly would be possible to fix up
legend so that when used with Hershey fonts everything
lines up as expected.

More information about the R-help mailing list