Dennis Fisher
2023-Jun-08 02:14 UTC
[R] need help with plotmath and/or plotting unicode characters
R 4.2.3 OS X Colleagues This should be easy -- but not for me. I want to plot text similar to this: N ? XX: YY where XX can be either 1 or 50 and YY is an integer I envision that there would be two solutions: UNICODE: If I can generate "?" via unicode, the problem is solved: mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY)) PLOTMATH: mtext(side=3, bquote(N <= .(XX) ~":" ~ .(YY))) This comes close: N ? 2 : 13 but I want to remove the space between the 2 and ":" Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com
Ivan Krylov
2023-Jun-08 09:04 UTC
[R] need help with plotmath and/or plotting unicode characters
On Wed, 7 Jun 2023 19:14:58 -0700 Dennis Fisher <fisher at plessthan.com> wrote:> UNICODE: If I can generate "?" via unicode, the problem is solved: > mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY))It should be possible to just copy & paste "?" in the R source code nowadays. If for some reason the script has to stay ASCII-encoded, use '\u2265'.> PLOTMATH: > mtext(side=3, bquote(N <= .(XX) ~":" ~ .(YY))) > This comes close: > N ? 2 : 13 > but I want to remove the space between the 2 and ":"Use paste(.(XX), ":") or even just .(XX) * ":" to output them close together. -- Best regards, Ivan
Richard M. Heiberger
2023-Jun-08 17:39 UTC
[R] [External] need help with plotmath and/or plotting unicode characters
Use * instead of ~ XX <- 5 YY <- 10 plot(1:10) mtext(side=3, bquote(N <= .(XX) ~":" ~ .(YY))) mtext(side=1, bquote(N <= .(XX) *":" * .(YY)))> On Jun 7, 2023, at 22:14, Dennis Fisher <fisher at plessthan.com> wrote: > > R 4.2.3 > OS X > > Colleagues > > This should be easy -- but not for me. > > I want to plot text similar to this: > N ? XX: YY > > where XX can be either 1 or 50 and YY is an integer > > I envision that there would be two solutions: > > UNICODE: If I can generate "?" via unicode, the problem is solved: > mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY)) > > PLOTMATH: > mtext(side=3, bquote(N <= .(XX) ~":" ~ .(YY))) > This comes close: > N ? 2 : 13 > but I want to remove the space between the 2 and ":" > > Dennis > > > > Dennis Fisher MD > P < (The "P Less Than" Company) > Phone / Fax: 1-866-PLessThan (1-866-753-7784) > http://www.plessthan.com/ > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.