[R] Saving .eps files with Times New Roman font

Yixuan Qiu yixuan.qiu at cos.name
Thu Jun 23 19:45:40 CEST 2016


You may want to use the showtext package that converts fonts into
curves in your graph. Below is the sample code:


library(showtext)
## Load Times New Roman fonts on Windows
font.add("times", regular = "times.ttf", bold = "timesbd.ttf")
showtext.auto()

setEPS()
postscript("test.eps")
par(family = "times")
plot(rnorm(100), main = "Test Font")
dev.off()


Best,
Yixuan

2016-06-23 13:15 GMT-04:00 A A via R-help <r-help at r-project.org>:
> In RGui, I'm running the following bit of code:
> windowsFonts(A=windowsFont("Times New Roman"))
> plot(0,0, ylab='y axis', xlab='x axis',main='title',family="A")
> The labels and title appear in Times New Roman font. So far, so good. However, when I right click the figure and select 'Save as postscript...', I get a .eps file of the plot, but without the font formatting that I applied. Is there any way to apply the formatting so that it gets saved?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Yixuan Qiu <yixuan.qiu at cos.name>
Department of Statistics,
Purdue University



More information about the R-help mailing list