[R] [FORGED] can't print ggplot with Chinese characters to pdf files

Martin Møller Skarbiniks Pedersen traxplayer at gmail.com
Fri Oct 20 14:27:30 CEST 2017

On 20 October 2017 at 04:21, John <miaojpm at gmail.com> wrote:
> Hi,
>    Following Paul's instruction, I have installed the Cairo. I tried to
> the program, and there is no error message at all. I did see the Chinese
> title in the plot if I ask my RStudio to show the plot (if I type "p1"),
> but the pdf file shows the plots without the Chinese titles.


> cairo_pdf("test_plot_chinese.pdf")
> print(m2)
> dev.off()

The help page for cairo_pdf says: "
‘cairo_pdf’ and ‘cairo_ps’ sometimes record _bitmaps_ and not vector
graphics.  On the other hand, they can (on suitable platforms) include a
     wider range of UTF-8 glyphs, and embed the fonts used.
I am not sure what sometimes means but maybe the fonts are not embedded in
the pdf-file?


note that it might fails if you haven't installed gs (ghostscript)


	[[alternative HTML version deleted]]

More information about the R-help mailing list