Graphic Devices Based on AGG
This package provides graphic devices for R based on the AGG library developed by the late Maxim Shemanarev. AGG provides both higher performance and higher quality than the standard raster devices provided by grDevices. For a comparison with the default devices, see the performance and quality vignettes.
The package can be installed from CRAN with
install.packages('ragg')or, if the development version is desired, directly from github:
# install.packages('devtools') devtools::install_github('r-lib/ragg')
ragg provides drop-in replacements for the png, jpeg, and tiff graphic devices provided by default from the grDevices packages and can both produce png, jpeg and tiff files. Notable features, that sets itself apart from the build-in devices, includes:
You can use it like any other device. The main functions are
agg_tiff(), all of which have arguments that closely match those of the
tiff()functions, so switching over should be easy.
Further, it provides anagg_capture()device that lets you access the device buffer directly from your R session.cap
Use ragg with knitr
knitr supports png output from ragg by settingdev = "ragg_png"in the chunk settings or globally withknitr::opts_chunk$set(dev = "ragg_png").
Use ragg in RStudio
ragg can be used as the graphic back-end to the RStudio device (for RStudio >= 1.4) by choosing AGG as the backend in the graphics pane in general options (see screenshot)
Code of Conduct
Please note that the ‘ragg’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.