[R] Include plotting symbals pch 16 and 17 into captions / text in pdf graph

Rainer M Krug Rainer at krugs.de
Mon Jul 21 14:10:19 CEST 2014


Hi

I want to include the plotting symbols pch=16 and pch=17 in text in
the graph used as labels.

This works:

--8<---------------cut here---------------start------------->8---
plot(0:1,0:1, type="n")
points(0.2, 1, pch=16)
mtext(
        text = "pch=16 (\U25CF)",
        side = 3,
        at   = 0.2,
        line = 1,
    )
points(0.8, 1, pch=17)
mtext(
        text = "pch=17 (\U25B2)",
        side = 3,
        at   = 0.8,
        line = 1
    )
--8<---------------cut here---------------end--------------->8---

But I would need this as a pdf and in Calibri font, which does not
include the UTF symbol \U25B2 (the triangle). I got that far:

--8<---------------cut here---------------start------------->8---

cairo_pdf("utftext.pdf", family="Calibri")
plot(0:1,0:1, type="n")
points(0.2, 1, pch=16)
mtext(
        text = "pch=16 (\U25CF)",
        side = 3,
        at   = 0.2,
        line = 1,
    )
points(0.8, 1, pch=17)
mtext(
        text = "pch=17 (\U25B2)",
        side = 3,
        at   = 0.8,
        line = 1
    )
dev.off()
--8<---------------cut here---------------end--------------->8---

which results in the attached pdf (hope it comes through). If not: the
utf symbol for the upward error is displayed as an empty square with a
question mark in it).

Is there a way that I can show the plotting symbol pch=17 in the caption
when using this font?

Thanks,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utftext.pdf
Type: application/pdf
Size: 19165 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140721/7da08222/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140721/7da08222/attachment.bin>


More information about the R-help mailing list