I'm trying to combine multi-line text and math annotations on a plot and am not having much luck. I looked at various suggestions in the archives, but I cannot coerce any of them to do what I want. I'm beginning (finally?!) to think that there is an entirely better approach than the one I have tried.
The essential problem is that line breaks (\n) don't seem to behave the way I expected when combined with text strings and plotmath in a call to text(). My vision for the annotation, which may be a little beyond the norm, is to have a series of centered lines of text somewhere on the plot that includes various object values and symbols. I'd like to wrap it all up in one call to text() so that it has a common anchor. Here is an example: a <- c(1, 10) b <- c(1, 10) amean <- mean(a) bmean <- mean(b) plot(a, b) # Annotation with paste() text(amean, bmean, bquote(paste("Here are the values\nI want to write on the plot\n\n", amean==.(amean), "\nand\n", bmean==.(bmean)))) # Annotation without paste() text(amean, bmean, bquote('Here are the values\nI want to write on the plot\n\n'~amean==.(amean)~'\nand\n'~bmean==.(bmean))) Another suggestion in the archives involved creating a list with the strings that were then passed through parse(), but that did not work either. Corrections, suggestions, or redirections greatly appreciated. -- Dave Hewitt Research Fishery Biologist US Geological Survey, Klamath Falls, OR, USA ______________________________________________ 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.