[R] Using square brackets in a ploted expression

762 views
Skip to first unread message

Monteiro, Jose

unread,
Jan 11, 2013, 7:43:01 AM1/11/13
to r-h...@r-project.org
Dear Users,

I have the following text plotted inside a graphic:


text(16200, 2.8*0.97, expression(NH[3]==0.33-1.1 %*% 10^-5 %*% day),

adj=c(1,1))

I need to include square brackets in the expression around the ammonia to have it plotted like that: [NO3-]. I tried instinctively to use %[% to plot the brackets, but it did not work. Does anybody of you know what is the correct syntax to plot square brackets inside an expression?

Thank you in advance,
José

[[alternative HTML version deleted]]

Uwe Ligges

unread,
Jan 12, 2013, 1:29:48 PM1/12/13
to Monteiro, Jose, r-h...@r-project.org


On 11.01.2013 13:43, Monteiro, Jose wrote:
> Dear Users,
>
> I have the following text plotted inside a graphic:
>
>
> text(16200, 2.8*0.97, expression(NH[3]==0.33-1.1 %*% 10^-5 %*% day),
>
> adj=c(1,1))
>
> I need to include square brackets in the expression around the ammonia to have it plotted like that: [NO3-]. I tried instinctively to use %[% to plot the brackets, but it did not work. Does anybody of you know what is the correct syntax to plot square brackets inside an expression?


See ?plotmath:

plot(1, main=expression(group("[", NO[3]^"-","]")))

Uwe Ligges


> Thank you in advance,
> José
>
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-h...@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.
>

______________________________________________
R-h...@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.
Reply all
Reply to author
Forward
0 new messages