Hello, I am trying to generate a plot legend that contains calculated summary statistics, one statistic is R^2. I have tried several variations using the commands "expression" and "bqoute" as stated on the R help pages. I have not been able to get the R^2 super script correct along with the calculated statistics.
I provided an example below, what I want is the legend (wdt_leg and spas_leg) as below but with the R^2 as superscript. # Example Data x=c(1,2,3,4); y=c(1,2,3,4); z=c(1.25,1.5,2.5,3.5) # first stats based on data, used to populate legend wdt_n = 50; wdt_mbias = 0.58 wdt_mae = 2.1; wdt_R2 = 0.85 # second stats based on data, used to populate legend spas_n = 50; spas_mbias = 0.58 spas_mae = 2.1; spas_R2 = 0.85 # create legend wdt_leg <- paste("WDT (N = ", wdt_n,", Bias = ",wdt_mbias,", MAE = ",wdt_mae, ", R2 = ", wdt_R2, ")", sep="") spas_leg <- paste("SPAS (N = ", spas_n,", Bias = ",spas_mbias,", MAE = ",spas_mae, ", R2 = ", spas_R2, ")", sep="") # create plot plot(x,y, col="red1", pch=1); lines(x,z, type="p", col="green4",pch=3) leg.txt <- c(spas_leg, wdt_leg) legend("topleft", legend = leg.txt, col=c("red1","green4"), pch=c(1,3), cex=0.85) Any help/suggestions on this would be great. Thanks for your time in advance. Doug -- --------------------------------- Douglas M. Hultstrand, MS Senior Hydrometeorologist email: dmhul...@metstat.com web: http://www.metstat.com --------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.