[R] problem with math expressions in grid graphics when using line breaks (\n)
djmuser at gmail.com
Thu Sep 8 23:30:53 CEST 2011
>From the plotmath help page:
"Control characters (e.g. \n) are not interpreted in character strings
in plotmath, unlike normal plotting."
In other words, "you can't do that".
However, since you're using grid graphics, this thread from the
ggplot2 group might be helpful:
The code by Baptiste Auguie is what to look for.
On Thu, Sep 8, 2011 at 10:20 AM, Mark Heckmann <mark.heckmann at gmx.de> wrote:
> I want to plot a multiline annotation including a mathematical expression using grid graphics (grid.text).
> This works fine for a single line, but the math expression is misplaced when I insert a line break ("\n" escape sequence):
> grid.text(expression(paste("Some words here\n more ", sigma)))
> Does someone have an idea how to fix that?
> Mark Heckmann
> Blog: www.markheckmann.de
> R-Blog: http://ryouready.wordpress.com
> R-help at r-project.org mailing list
> 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