[R] Plotmath integral gets horrible with URWPalladio

Paul Smith phhs80 at gmail.com
Wed Oct 3 13:43:11 CEST 2007


On 10/3/07, Paul Murrell <paul at stat.auckland.ac.nz> wrote:
> > With the following code:
> >
> > pdf(file="figure.pdf",family="URWPalladio")
> > plot(0,0,type="n")
> > text(0,0,expression(integral(f(x)*dx, a, b)))
> > dev.off()
> >
> > the integral symbol gets horrible. With other fonts, the same does not
> > occur. Is there some way of using Palatino-like fonts with a nice
> > integral symbol? I am using R 2.5.1 on F7 (Linux).
>
>
> That could just be your viewer not being able to find the font (which is
> what happens to me on this example).  Try using embedFonts(), like this ...
>
> embedFonts("figure.pdf")
>
> ... which, if it succeeds, will place the fonts in the PDF and the
> viewer should be happy.
>
> If that does not work, a workaround is to specify a different symbol
> font, like this ...
>
> mypal <- Type1Font("URWPalladio",
>                     c("p052003l.afm", "p052004l.afm",
>                       "p052023l.afm", "p052024l.afm",
>                       "Symbol.afm"))
> pdfFonts(mypal=mypal)
> pdf(file="figure.pdf",family="mypal")
> plot(0,0,type="n")
> text(0,0,expression(integral(f(x)*dx, a, b)))
> dev.off()

Thanks, Paul. The command 'embedFonts("figure.pdf")' does the trick.
Thanks further for having written a so useful book: "R Graphics".

Paul



More information about the R-help mailing list