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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 23 Jul 2005 - 12:55:04 EST

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"

plot(1:5)

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.



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 Sat Jul 23 13:00:38 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:58 EST