text in ggplot on the axes is not kept in the same language when rendered to pdf

Hi,

I am working with surveys in Armenian Language.

I have a plot created by ggplot, that has the text on both x and y axis in Armenian Language as such:
(see plot_1 attached)

Whenever this plot is rendered to PDF, the Armenian text does no longer appear, instead ...... appears. (see plot_2 attached)plot_2.pdf (6.1 KB)

How can I solve this issue? Is the text in ggplot restricted to specific language?

The below is the code that I am using:

library(ggplot2)
ggplot(mtcars, aes(hp, mpg)) +
geom_point() + labs(x = 'կառնի', y = 'կառնի')

Thank you in advance.
Best,
Karni

Hi Karni,

might this be related to the font which does not contain those symbols or the pdf device?

Things I would try:

  • export the pdf using device = cairo_pdf if you didn't use it yet
  • check other fonts, best one where you know the sybols exist

Here is a blog post that helped me a lot back then to fix issues with fonts, quality and ratios: https://www.andrewheiss.com/blog/2017/09/27/working-with-r-cairo-graphics-custom-fonts-and-ggplot/

I hope this helps!

Cheers, Cédric

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.