Wrong symbol rendering in plots (Ubuntu)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong symbol rendering in plots (Ubuntu)

ejchica
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

Ben Bolker
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

plangfelder
On Fri, Jun 4, 2010 at 1:44 PM, Ben Bolker <[hidden email]> wrote:

> 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

I have noticed something similar. Even a regular plot, say

plot(c(1:10))

when put into a pdf file via pdf() device, will display incorrect
symbols in linux pdf viewers (evince, okular). The circles (o) become
q, literally the letter q, and lose colors. In Acroread I see the
plots as they should be. This started happening around R-2.9 or so. Am
also not sure whether it's the R pdf or pdfCairo, or whether it's a
bug in the evince/okular backend.

Peter

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

Erik Iverson-3


> plot(c(1:10))
>
> when put into a pdf file via pdf() device, will display incorrect
> symbols in linux pdf viewers (evince, okular). The circles (o) become
> q, literally the letter q, and lose colors.

This issue is already in the Notes section of ?pdf.  It remains to be
seen if the OP's problem was this exact one, since they didn't specify
an example.

 From ?pdf,

      On some systems the default plotting character ‘pch = 1’ is
      displayed in some PDF viewers incorrectly as a ‘"q"’ character.
      (These seem to be viewers based on the ‘poppler’ PDF rendering
      library). This may be due to incorrect or incomplete mapping of
      font names to those used by the system.  Adding the following
      lines to ‘~/.fonts.conf’ or ‘/etc/fonts/local.conf’ may circumvent
      this problem.



      <alias binding="same">
             <family>ZapfDingbats</family>
             <accept><family>Dingbats</family></accept>
      </alias>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

plangfelder
>
> This issue is already in the Notes section of ?pdf.  It remains to be seen
> if the OP's problem was this exact one, since they didn't specify an
> example.

aahhh, thank you for pointing this out. I never noticed this note.

Peter

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

yvonnick noel
In reply to this post by ejchica
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

Ben Bolker
Yvonnick NOEL <yvonnick.noel <at> uhb.fr> writes:

>
> 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
>
>

  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?

  If not it might be worth continuing this thread on r-devel .
It does seem that there are two (related?) issues, one with
pch=1 and the other with Symbol (???) fonts ...

 For reference:

http://ubuntuforums.org/showthread.php?t=1325289

 although it's also not clear whether this is exactly
the same issue, or a related/similar one.
 
============================
 On some systems the default plotting character ‘pch = 1’ is
     displayed in some PDF viewers incorrectly as a ‘"q"’ character.
     (These seem to be viewers based on the ‘poppler’ PDF rendering
     library). This may be due to incorrect or incomplete mapping of
     font names to those used by the system.  Adding the following
     lines to ‘~/.fonts.conf’ or ‘/etc/fonts/local.conf’ may circumvent
     this problem.

     
     
     <alias binding="same">
            <family>ZapfDingbats</family>
            <accept><family>Dingbats</family></accept>
     </alias>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

yvonnick noel
In reply to this post by ejchica
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Wrong symbol rendering in plots (Ubuntu)

ejchica
In reply to this post by ejchica
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]]

______________________________________________
[hidden email] 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.