R plot title encoding in Pdf

encoding, plot, r

Solution

I finally found the solution,

Substituting `pdf(file='/home/sait/Desktop/abc.pdf')` with `cairo_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.

Problem

This question is related to: Rhtml: Warning: conversion failure on '<var>' in 'mbcsToSbcs': dot substituted for <var> and R doesn't open with UTF-8 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ı') ``` I am having the following warning messages when I run the script using `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> ``` 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. 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: I continue investigating this issue, and realized that if I use `.png`, it works perfectly, only problem is with `.pdf`.

Original source

Related problems