Graphics Reference
In-Depth Information
# On Windows, you may need to tell it where Ghostscript is installed
# (adjust the path to match your installation of Ghostscript)
Sys.setenv(R_GSCMD
=
"C:/Program Files/gs/gs9.05/bin/gswin32c.exe"
)
Finally, you can create a PDF file and embed fonts into it, as in
Figure 14-4
:
library(ggplot2)
ggplot(mtcars, aes(x
=
wt, y
=
mpg))
+
geom_point()
+
ggtitle(
"Title text goes here"
)
+
theme(text
=
element_text(size
=
16
, family
=
"Impact"
))
ggsave(
"myplot.pdf"
, width
=
4
, height
=
4
)
embed_fonts(
"myplot.pdf"
)