[R] Why do I get a linebreak in the legend?
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 [EMAIL PROTECTED] __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do I get a linebreak in the legend?
try the following: x - runif(100, -4, 4) y - 1 + 2 * x + rnorm(100, sd = 2) fit - lm(y ~ x) plot(x, y) abline(fit) legend(topleft, expression(paste(R[adj]^2, = 0.66))) ## or plot(x, y) abline(fit) legend(topleft, legend = substitute(R[adj]^2 == x, list(x = summary(fit)$adj.r.squared))) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: CG Pettersson [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, November 09, 2006 9:10 AM Subject: [R] Why do I get a linebreak in the legend? 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 [EMAIL PROTECTED] __ 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 and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do I get a linebreak in the legend?
Hi CG, move one of the parens: legend(topleft, expression(paste(R[adj]^2, = 0.66))) Cheers Andrew On Thu, Nov 09, 2006 at 09:10:49AM +0100, CG Pettersson 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 [EMAIL PROTECTED] __ 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 and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do I get a linebreak in the legend?
Try: legend(topleft, expression(R[adj]^2 == 0.66)) On 11/9/06, CG Pettersson [EMAIL PROTECTED] 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 [EMAIL PROTECTED] __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.