Hi I am having problems with the rendering of scientific symbols (mu and degree) in my plots. Whenever I use these symbols they are rendered changed (mu is changed to the proportionality symbol and degree is changed to something resembling a gamma) in the X-device. If I make a pdf of the plot and open the file in Evince or Okular symbols are also rendered wrong, however if I open the file with Xpdf or Acroread they are rendered correctly. I did not have this problem before, it arose after I upgraded both R and my system (Ubuntu karmic koala to lucid lynx), so I can not tell for sure if the problem is R-related or Ubuntu related (I have posted in a Ubuntu forum also http://ubuntuforums.org/showthread.php?t=1325289). Please let me know if you have any idea of how to fix this, or if you can confirm this is not an R-related issue. Thank you very much in advance, Eduardo J. Chica Graduate student UF/IFAS-CREC
Eduardo J. Chica <ejchica <at> gmail.com> writes:> Hi I am having problems with the rendering of scientific symbols (mu and > degree) in my plots. Whenever I use these symbols they are rendered > changed (mu is changed to the proportionality symbol and degree is > changed to something resembling a gamma) in the X-device. If I make a > pdf of the plot and open the file in Evince or Okular symbols are also > rendered wrong, however if I open the file with Xpdf or Acroread they > are rendered correctly. > > I did not have this problem before, it arose after I upgraded both R and > my system (Ubuntu karmic koala to lucid lynx), so I can not tell for > sure if the problem is R-related or Ubuntu related (I have posted in a > Ubuntu forum also http://ubuntuforums.org/showthread.php?t=1325289).Could you please post a reproducible example? It would be good to see exactly what you are doing, and it will save time for anyone who wants to try your example on their machine to try to narrow down the problem. Ben Bolker
Hello, I have the very same problem. Plotting code that used to work before I upgraded to Ubuntu Lucid Lynx does not work anymore. For example: plot(1:10) text(6,4,expression(pi)) The 'pi' greek letter appear as a \neq ("different from" symbol). Yvonnick Noel
Hello Ben,> Does the workaround pointed out later in the thread you're > responding to (from the last paragraph of a very long 'Note' > section of ?pdf) help? >Well, I did not try to edit my fonts.conf but I feel this is not a PDF issue. I have no problem to have greek letters correctly rendered in Ubuntu 10.04 (with LaTeX, or OpenOffice Math for instance with a PDF export). This only appears in R plots. Note that other symbols do not render well too. I put a PDF output of demo(plotmath) here: http://yvonnick.noel.free.fr/wrongsymbolsinubuntu.pdf Thank you. Yvonnick > sessionInfo() R version 2.11.0 (2010-04-22) i486-pc-linux-gnu locale: [1] LC_CTYPE=fr_FR.utf8 LC_NUMERIC=C [3] LC_TIME=fr_FR.utf8 LC_COLLATE=fr_FR.utf8 [5] LC_MONETARY=C LC_MESSAGES=fr_FR.utf8 [7] LC_PAPER=fr_FR.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=fr_FR.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base
[moving to r-devel] This PDF looks fine in all of the viewers I have (xpdf 3.02, okular 0.8.2, acroread 8.1.3, evince/poppler 0.8.7) ... I don't really know enough about PDF/fonts/etc. to debug this ... if I were going to continue with this I would probably make some kind of minimal plot:> pdf("test.pdf") > plot(0:1,0:1,type="n",axes=FALSE,ann=FALSE) > text(0.5,0.5,expression(alpha %prop% beta)) > dev.off()(this comes out to only 1397 bytes on my system), make the equivalent plot with LaTeX \documentclass{article} \begin{document} $$ \alpha \propto \beta $$ \end{document} (7514 bytes) and try to figure out how the fonts are being treated differently ... Yvonnick Noel wrote:> Hello Ben, >> Does the workaround pointed out later in the thread you're >> responding to (from the last paragraph of a very long 'Note' >> section of ?pdf) help? >> > Well, I did not try to edit my fonts.conf but I feel this is not a PDF > issue. I have no problem to have greek letters correctly rendered in > Ubuntu 10.04 (with LaTeX, or OpenOffice Math for instance with a PDF > export). This only appears in R plots. > > Note that other symbols do not render well too. I put a PDF output of > demo(plotmath) here: > > http://yvonnick.noel.free.fr/wrongsymbolsinubuntu.pdf > > Thank you. > > Yvonnick > > > sessionInfo() > R version 2.11.0 (2010-04-22) > i486-pc-linux-gnu > > locale: > [1] LC_CTYPE=fr_FR.utf8 LC_NUMERIC=C > [3] LC_TIME=fr_FR.utf8 LC_COLLATE=fr_FR.utf8 > [5] LC_MONETARY=C LC_MESSAGES=fr_FR.utf8 > [7] LC_PAPER=fr_FR.utf8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=fr_FR.utf8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base >-- Ben Bolker Associate professor, Biology Dep't, Univ. of Florida *** NEW E-MAIL ADDRESSES: *** bbolker at gmail.com , bolker at math.mcmaster.ca bolker at ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20100607/6c5fb127/attachment.bin>
Paul Johnson
2010-Jun-07 14:40 UTC
[R-sig-Debian] [R] Wrong symbol rendering in plots (Ubuntu)
Dear Eduardo I have been testing! Please try this experiment. Create a pdf figure in R. Suppose you call it "myfig.pdf" Then run> embedFonts("myfig.pdf", out="newmyfig.pdf")For me, that embeds fonts and solves the problem of symbols rendering badly in the newmyfig.pdf. After you become confident in this, it seems also to work to just write the same pdf on itself.> embedFonts("myfig.pdf")does rewrite the original figure. I don't know the implications of this for the file size of a pdf that is created from Latex that incorporates a lot of pdf figures. Will test soon. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
Paul Johnson
2010-Jun-07 19:34 UTC
[R-sig-Debian] Fwd: [R] Wrong symbol rendering in plots (Ubuntu)
I sent the message accidentally to r-help, but I intended to follow r-sig-debian because it is about the problem that Evince doesn't render symbols properly. it explains why I think the embedFonts function in R is the "magic bullet" ---------- Forwarded message ---------- From: Paul Johnson <pauljohn32 at gmail.com> Date: Mon, Jun 7, 2010 at 9:28 AM Subject: Re: [R] Wrong symbol rendering in plots (Ubuntu) To: "Eduardo J. Chica" <ejchica at gmail.com> Cc: r-help at r-project.org On Fri, Jun 4, 2010 at 12:01 PM, Eduardo J. Chica <ejchica at gmail.com> wrote:> Hi I am having problems with the rendering of scientific symbols (mu and > degree) in my plots. Whenever I use these symbols they are rendered changed > (mu is changed to the proportionality symbol and degree is changed to > something resembling a gamma) in the X-device. If I make a pdf of the plot > and open the file in Evince or Okular symbols are also rendered wrong, > however if I open the file with Xpdf or Acroread they are rendered > correctly. > > I did not have this problem before, it arose after I upgraded both R and my > system (Ubuntu karmic koala to lucid lynx), so I can not tell for sure if > the problem is R-related or Ubuntu related (I have posted in a Ubuntu forum > also http://ubuntuforums.org/showthread.php?t=1325289). > > Please let me know if you have any idea of how to fix this, or if you can > confirm this is not an R-related issue. >I run Ubuntu as well and I see the same problem when I view a pdf with Evince, the default document viewer. ?In Adobe's Acorbat reader, acroread, the symbols show correctly. Here's an example pdf file: ?http://pj.freefaculty.org/linux/pm92.pdf In Evince, instead of mu, you see the proportional to symbol. In the Ubuntu bugtracker, this problem has been reported and they say it has been fixed, but I still see it. https://bugs.launchpad.net/ubuntu/+source/poppler/+bug/518236 http://art.ubuntuforums.org/showthread.php?p=9410094 I believe the problem is a mismatch between the fonts available to R and to the various viewers. ?R does not embed all fonts in the pdf files. ?Open a suspect pdf in Evince or some other viewer and check on the fonts. In Evince, under the File/Properties menu, there's a font indication. None of the fonts in R pdfs are embedded. ?There is a way to embed fonts after in R, (see ?embedFonts) but I can't understand the documentation on how to do that. But I'm testing it out. I believe that the fonts installed in the system, combined with whatever user config changes occur, make this a tough problem to solve. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
Hello, please excuse me if this is a repost, I think I got confused about how to reply. Anyway, I posted the message below about a day and a half ago through Nabble but have not been cleared until today. Here it goes again. Please bear with me I will get better with time. ----Start of message sent about two days ago--- Hello all, thank you very much for the replies and I am very sorry for being so late to come back to the discussion, I was on a field trip without internet access. @ Ben I have the problem any time I try to use the mu symbol or the degree symbol using expression() (the only way I know how to do it). Yvonnick's code is a good example, I have just added the mu and the degree symbol: pdf("Test.pdf") plot(1:10,xlab=expression(mu), ylab=expression(C*degree~pi)) dev.off() Even if I don't make the pdf (i.e. just plot on the X11 device), like in Yvonnick's example, the degree symbol is still showing as that gamma-like symbol, pi is shown like an inequality symbol but mu is shown right (on the X11). @ Erik and Yvonnick I think Yvonnick's problem is the same I have (i.e. it is not restricted to pdf files, it also happens in the X11 device, jpg and png). Further, if I create a pdf in Ooo Writer that contains mu, pi or degree symbols and I export them as pdf, they are rendered just fine (similar to what Peter reported, not sure whether he has problems in the X11 device too), the problem is restricted to R-generated graphs. I am going to try Erik's suggestion tonight (sorry I could not try it before posting, I am still catching up with work accumulated from my trip). However, would this fix the problem in rendering in the X11 device? I also feel this might not be just a pdf-viewer issue, but I am an absolute novice. ----End of message sent about two days ago--- Since then, i tried Erik's suggestion, but I could not find either '~/.fonts.conf' or '/etc/fonts/local.conf' in my system (at least with those exact names). I also got a reply from Prof. Ripley (quote below), I am working on it now, but maybe more experienced users will be more efficient in using it than me. "Your first para confirms it. The problem is font selection by fontconfig, which R's X11 device and Evince etc use and Xpdf or Acroread do not. See ?X11 for ways to debug this." Thanks! Eduardo > sessionInfo() R version 2.11.1 (2010-05-31) i486-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base [[alternative HTML version deleted]]