Open jeroen opened 4 years ago
library(ggplot2) unlink(c("base.png", "ragg.png", 'rsvg.png')) test_plot <- function(){ ggplot(mtcars) + geom_point(aes(mpg, disp, colour = hp)) + labs(title = 'System fonts — Oh My!') + theme(text = element_text(family = 'Papyrus')) } system.time({ png('base.png', width = 1080, height = 720, res = 144) print(test_plot()) invisible(dev.off()) }) library(ragg) system.time({ agg_png('ragg.png', width = 1080, height = 720, res = 144) print(test_plot()) invisible(dev.off()) }) library(svglite) system.time({ s <- svgstring(width = 1080/144, height = 720/144) print(test_plot()) buf <- charToRaw(s()) invisible(dev.off()) rsvg::rsvg_png(buf, width=1080, height = 720, 'rsvg.png') })