How to get plots with hebrew labels support (using knit for exporting to pdf)?

81 views
Skip to first unread message

Gilco333

unread,
Aug 24, 2016, 1:09:38 PM8/24/16
to Israel R User Group
Hi guys,
I'm trying to export a simple plot with Hebrew labels from a Rnw file to a PDF file.
Although the actual document is written with some Hebrew characters, when it comes to the plots, it doesn't show me the Hebrew words correctly at all.

I'm using Linux (Ubuntu 16.04.1 LTS) and have played with few functions , but not sure how to set them right :/

Sys.setlocale("LC_ALL", "Hebrew")
pdf.options(encoding=??)

Does anyone has a suggestion how to resolve this issue?

Thank again
תודה לכל המסייעים :)
גיל

Ron Rotkopf

unread,
Sep 8, 2016, 2:02:04 AM9/8/16
to Israel R User Group
Same (or similar) problem in Windows.
Hebrew labels appear fine in the RStudio plot window (and in jpg), but when exporting to pdf, Hebrew characters turn to dots.

Thanks for any help!
Ron

Michael Dorman

unread,
Sep 8, 2016, 2:58:00 AM9/8/16
to Israel R User Group
My experience with Hebrew in R plots is as follows - 

1. A PDF plot with Hebrew on Windows can be produced with CairoPDF (package Cairo) after setting Sys.setlocale("LC_ALL", "Hebrew"). The regular PDF device turns characters to dots, as Ron pointed out. However the text characters order is reversed (!). The struggle with manual reversal of characters in each plotted text was my main reason for moving to Linux.

2. On Linux (Ubuntu 14.04 & 16.04), Hebrew PDF plots are produced with the basic cairo_pdf without any adjustments. Rnw reports with Hebrew (either in plots or regular text) also work in HTML output, but not PDF output. I guess this is a LaTeX issue. 

If someone discovered other solutions will be happy to hear :)

Thanks,

Michael
Screenshot from 2016-09-08 09-40-57.png

Ron Rotkopf

unread,
Sep 8, 2016, 6:39:49 AM9/8/16
to Israel R User Group
Thanks, Michael!



On Wednesday, August 24, 2016 at 8:09:38 PM UTC+3, Gilco333 wrote:
Reply all
Reply to author
Forward
0 new messages