R绘图标题编码在Pdf

R绘图标题编码在Pdf

本文介绍了R绘图标题编码在Pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题涉及:和

我使用Ubuntu,我不能显示土耳其字符,ı,在剧情的标题:

I use Ubuntu, I can not show a turkish character, ı, on the title of a plot:

myScript.r

pdf(file='/home/sait/Desktop/abc.pdf')
plot(1:7,1:7,main='geziparkı')

当我使用运行脚本时,我收到以下警告消息Rscript myScript.r

Warning messages:
1: In title(...) :
  conversion failure on 'geziparkı' in 'mbcsToSbcs': dot substituted for <c4>
2: In title(...) :
  conversion failure on 'geziparkı' in 'mbcsToSbcs': dot substituted for <b1>
3: In title(...) :
  conversion failure on 'geziparkı' in 'mbcsToSbcs': dot substituted for <c4>
4: In title(...) :
  conversion failure on 'geziparkı' in 'mbcsToSbcs': dot substituted for <b1>

我添加了行 pdf.options(encoding ='ISOLatin2.enc' )在我的脚本的顶部,如上述相关问题所述,没有帮助。

I added the line pdf.options(encoding='ISOLatin2.enc') on the top of my script as mentioned in the related previous questions, did not help.

我需要从我的 locale Ubuntu的设置。我的 sessioinInfo()正在关注,

Do I need to change something from my locale settings of Ubuntu. My sessioinInfo() is following,

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=tr_TR.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=tr_TR.UTF-8        LC_COLLATE=tr_TR.UTF-8
 [5] LC_MONETARY=tr_TR.UTF-8    LC_MESSAGES=C
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=tr_TR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

PS:我继续调查这个问题,并意识到如果我使用 .png ,它的工作是完美的,只有问题是与 .pdf

PS: I continue investigating this issue, and realized that if I use .png, it works perfectly, only problem is with .pdf.

推荐答案

我终于找到了解决方案,

I finally found the solution,

替换 pdf(file ='/ home / sait / Desktop / abc.pdf') with
cairo_pdf('/ home / sait / Desktop / abc。 pdf,family =DejaVu Sans)做了一个伎俩。

Substituting pdf(file='/home/sait/Desktop/abc.pdf') withcairo_pdf('/home/sait/Desktop/abc.pdf', family="DejaVu Sans") did the trick.

我不知道这是做什么,但是我尝试过很多东西,没有任何工作,除了这一个。

I do not know what this actually done, however I have tried a lot of stuff and nothing has worked except this one.

这篇关于R绘图标题编码在Pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 02:09