Search code examples
rplotspecial-characters

Special letters on axis, R plot


I have a problem with special letters in plots. Here's an example:

plot(1:10,1:10, xlab="Idő", ylab=" ")

After I export the plot in pdf, which is what i need, the "ő" letter disappears from the text and becomes simply "Ido". How can it be solved?

Thanks!


Solution

  • The problem is with the default encoding of the pdf device in RGui. You'll have to open and close the device from R:

    pdf(file="test.pdf", encoding="CP1250")
    plot(1:10,1:10, xlab="Id\U0151", ylab=" ")
    dev.off()