[R] Problem with national characters in main, xlab, ylab with pdf{grDevices} / postscript {grDevices}

Magdalena A. Tkacz magdalena.tkacz at gmail.com
Sun Oct 7 18:07:01 CEST 2012


Hello.

I'm trying to make some graphics with nationalized labels (pdf for use
in LaTeX document).


On console (displayed on screen) using  all looks ok:
----------------------------------------\/
data<-rnorm(100)
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
-------------------------------------------/\

But using:
-------------------------------------------\/
data<-rnorm(100)

pdf('plik.pdf',encoding="CP1250.enc")
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
--------------------------------------------/\

It does not look fine ...

Without specifying encoding:
-------------------------------------------\/
pdf('plik-wo-enc.pdf')
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
---------------------------------------------/\
Almost does not have national characters. (Almost, because "ó" letter appears)

Exemplary pdf file are here:
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167942261/plik.pdf
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167945977/plik-wo-enc.pdf


I have read "Non-Standard Fonts in PostScript and PDF Graphics" by
Paul Murrell and Brian Ripley in Rnews.

I have also tried option with
-------------------\/
Sys.setlocale(category="LC_CTYPE", locale="pl_PL.utf8")
-------------------/\
but even in admin (run R as admin) in Win7 I received warning:
-------------------\/
"In Sys.setlocale(category = "LC_CTYPE", locale = "pl_PL.utf8") :
Żądania raportów OS aby ustawić lokalizację na "pl_PL.utf8" nie mogą
zostać wykonane"
-------------------/\
(translated in short : OS report request to set locale to "pl_PL.utf8"
can not be done)


Does anyone knows how to obtain pdf documents with acceptable quality?



Thanks in advance,

Regards

-- 
/|/| _ _ _/_ /_   _  /  / _ __
/   |(/(/(/(/((-/)(/ (  /((/( /_
     _/
Magdalena Tkacz



More information about the R-help mailing list