R绘制Pdf中的标题编码

这个问题与: Rhtml: Warning: conversion failure on ‘<var>’ in ‘mbcsToSbcs’: dot substituted for <var>R doesn’t open with UTF-8有关

我使用Ubuntu,我无法在剧情的标题上显示土耳其人物,ı:

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’),如前面相关问题所述,没有帮助.

我是否需要从Ubuntu的语言环境设置中更改某些内容.我的sessioinInfo()如下,

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

我终于找到了解决方案,

用pdf代替pdf(file =’/ home / sait / Desktop / abc.pdf’)
cairo_pdf(‘/ home / sait / Desktop / abc.pdf’,family =“DejaVu Sans”)成功了.

我不知道这实际上做了什么,但是我已经尝试了很多东西,除了这个之外什么都没有用.

本站公众号
   欢迎关注本站公众号,获取更多程序园信息
开发小院