Write R graphics output devices in plain R
devout is a package that enables R graphics devices to be written in
plain R.
devout uses a pseudo-graphics-device which translates graphics calls
into a call to an R function of your design.
This means we can create alternative output devices (like pdf() or
png()) using only plain R.
animation (click to close)
animation (click to close)
rdevice() - a generic device wrapper which will call the given R
function to handle the graphics drawing.rdevice())descriptive() - an output device which dumps information about
the device calls.ascii() - a graphics device which outputs an ascii
representation of the plot to a file, or to the console/terminalIf you want to write your own graphics device in plain R using devout
you can:
R/ascii-callback.R included in the packageA series of 4 vignettes are included in this package. They walk through the process of writing a naive SVG graphics device.
You can install from GitHub with:
# install.packages("remotes")
remotes::install_github("coolbutuseless/devout")debug deviceThe following 5 lines of code are about the simplest device you can
write with devout in plain R.
This devices prints each of the device calls that were generated when the plot was “drawn”.
…r library(ggplot2) library(sf) library(rnaturalearth) world
devout is now a way of writing graphics
devices in plain R with the ascii() device as an example.No open issues yet, or sync has not completed.