Readers, I tried to the following commands: plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D)) mtext(expression(A[1]~B[2]),"additional text",side=3,line=1) I receive the text that I want, but the command terminal shows the following response: Warning message: NAs introduced by coercion in: mtext(expression(A[1]~B[2]),"additional text", side = 3, What is my mistake please? Yours, r251 rhelpatconference.jabber.org
I have a question for you. What's your purpose to put "additional text" in the margin? In your code, the first expression(A[1]~B[2]) corresponds to text. If you wanna "additional text" together with expression(A[1]~B[2]), you should use paste. If you can clarify what kind of margin you want, that would be better to clear your confusions. By the way, you forgot a right ")" after ylab= statement. -- View this message in context: http://n4.nabble.com/margin-text-warning-message-NAs-coercion-tp1557567p1557591.html Sent from the R help mailing list archive at Nabble.com.
On 2010-02-16 9:21, e-letter wrote:> Readers, > > I tried to the following commands: > > plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D)) > mtext(expression(A[1]~B[2]),"additional text",side=3,line=1)Your plot() call is not reproducible. Anyway, try mtext(expression(A[1]~B[2]~~"additional text"),side=3,line=1) -Peter Ehlers> > I receive the text that I want, but the command terminal shows the > following response: > > Warning message: > NAs introduced by coercion in: mtext(expression(A[1]~B[2]),"additional > text", side = 3, > > What is my mistake please? > > Yours, > > r251 > rhelpatconference.jabber.org > > ______________________________________________ > R-help at 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. > >-- Peter Ehlers University of Calgary 403.202.3921
On 16/02/2010, Peter Ehlers <ehlers at ucalgary.ca> wrote:> On 2010-02-16 9:21, e-letter wrote: >> Readers, >> >> I tried to the following commands: >> >> plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D)) >> mtext(expression(A[1]~B[2]),"additional text",side=3,line=1) > > Your plot() call is not reproducible. > > Anyway, try > > mtext(expression(A[1]~B[2]~~"additional text"),side=3,line=1) >Thank you. I had seen the command (~~) in the help guide for the package plotmath(grdevices), but there is no statement that this command can be used to join the expression to literal text.