[R] "Low Pain" Unicode Characters in pdf graph?

Dennis Murphy djmuser at gmail.com
Sun May 15 16:21:20 CEST 2011


Hi:

For your specific problem, one way is:

plot( 0, xlim=c(0,5), ylim=c(0,5), type="n", cex = 2)
text(1, 1, expression(symbol('\252')))
text(2, 2, expression(symbol('\251')))
text(3, 3, expression(symbol('\250')))
text(4, 4, expression(symbol('\247')))

More generally, David's advice is sound; see ?plotmath and focus on
the sections 'Other symbols' and 'References'; the last reference
provides a summary table of standard symbols and their codes in
several formats.

HTH,
Dennis

On Sun, May 15, 2011 at 6:06 AM, ivo welch <ivo.welch at gmail.com> wrote:
> Dear R-experts---is there a relatively low-pain way to get unicode
> characters into a plot to a pdf device?
>
> pdf(file="cardsymbols.pdf")
> plot( 0, xlim=c(0,5), ylim=c(0,5), type="n")
> text(1,1, "♠")
> text(2,2, "♥")
> text(3,3, "♦")
> text(4,4, "♣")
> dev.off()
>
> (these are the characters that I need the most NOW, but this is a more
> generic question.)
>
> sincerely, /iaw
>
> ----
> Ivo Welch (ivo.welch at gmail.com)
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list