devoutpdf
is a hand-crafted PDF graphics device written in plain R.
It achieves this by invoking the devout
package to do all the interfacing between the C++ side and the R side.
Drawing commands which sent to the graphics device are used to construct a minipdf
document.
Given that pdf()
and cairo_pdf()
devices come with R, what’s the point of a third PDF output device?
The R code for this device is a single file about 300 lines long - most of which is whitespace and comments. Check it out on github
minipdf
.You can install from GitHub with:
devoutpdf::pdfout(filename = "man/figures/test1.pdf", width=5, height=4)
ggplot(mtcars) +
geom_point(aes(mpg, wt)) +
labs(title = "test1") +
theme_bw()
invisible(dev.off())
devoutpdf::pdfout(filename = "man/figures/test2.pdf", width = 6, height = 4)
ggplot(mtcars) +
geom_bar(aes(as.factor(cyl), fill = as.factor(cyl))) +
labs(title = "test2")
invisible(dev.off())
devoutpdf::pdfout(filename = "man/figures/test3.pdf", width = 6, height = 4)
ggplot(mtcars) +
geom_density(aes(mpg, fill = as.factor(cyl)), alpha = 1, size = 2) +
theme_bw()
invisible(dev.off())