newline in plotmath expressions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

newline in plotmath expressions

Pascal A. Niklaus
Hi all,

When trying to amend a graphic with a text, I run into the following problem:

   text(10,10,"First line\nSecond line",pos=2)

works. However, because I have a plotmath expression, I tried:

   text(10,10,expression("First line with"[subscript]*"\nsecond line"),pos=2)

but \n does not lead to the result I wish. I considered the plotmath help page
but could not find how to insert a newline.

Is there a possibility to insert linebreaks in plotmath expressions, or do I
have to print the individual lines with separete text commands?

Thanks for you help

Pascal

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: newline in plotmath expressions

Uwe Ligges
Pascal A. Niklaus wrote:

> Hi all,
>
> When trying to amend a graphic with a text, I run into the following problem:
>
>    text(10,10,"First line\nSecond line",pos=2)
>
> works. However, because I have a plotmath expression, I tried:
>
>    text(10,10,expression("First line with"[subscript]*"\nsecond line"),pos=2)
>
> but \n does not lead to the result I wish. I considered the plotmath help page
> but could not find how to insert a newline.
>
> Is there a possibility to insert linebreaks in plotmath expressions, or do I
> have to print the individual lines with separete text commands?

The latter.

Uwe Ligges


> Thanks for you help
>
> Pascal
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html