svglite is a graphics device that produces clean svg output, suitable for use on the web, or hand editing. Compared to the built-in svg()
, svglite is considerably faster, produces smaller files, and leaves text as is.
Install the development version from github with:
Compared to the base svg device, svglite is quite a bit faster:
library(svglite)
x <- runif(1e3)
y <- runif(1e3)
tmp1 <- tempfile()
tmp2 <- tempfile()
system.time({
svglite(tmp1)
plot(x, y)
dev.off()
})
#> user system elapsed
#> 0.003 0.001 0.003
system.time({
svg(tmp2, onefile = TRUE)
plot(x, y)
dev.off()
})
#> user system elapsed
#> 0.015 0.001 0.017
It also produces considerably smaller files:
In both cases, compressing to make .svgz
is worthwhile: