[R] Why do I get a linebreak in the legend?

Gabor Grothendieck ggrothendieck at gmail.com
Thu Nov 9 10:42:56 CET 2006


Try:

legend("topleft", expression(R[adj]^2 == 0.66))


On 11/9/06, CG Pettersson <cg.pettersson at evp.slu.se> wrote:
> Dear all,
>
> W2k, R2.4.0
>
> I want to place a legend in a regression plot, stating the adjusted
> R-square value. After some struggle with the coding I am nearly there, but
> only nearly. The best try so far is:
>
> legend("topleft", expression(paste(R[adj]^2), " = 0.66"))
>
> This places the proper information in the legend, but I get a linebreak
> before the "= 0.66" and I want the expression on one single line. All
> adjustments from this code I have tried so far either produces only half
> the expression or produces an error message.
>
> All the best and sorry for a trivial quastion
> /CG
>
>
> --
> CG Pettersson, MSci, PhD Stud.
> Swedish University of Agricultural Sciences (SLU)
> Dep. of Crop Production Ekology. Box 7043.
> SE-750 07 Uppsala, Sweden
> cg.pettersson at vpe.slu.se
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list