[R] Making my own graphics device

Paul Murrell paul at stat.auckland.ac.nz
Sun Aug 17 23:35:02 CEST 2014


On 08/18/14 07:58, Thomas Levine wrote:
> I want to make my own graphics device am thus looking for
> documentation about graphics devices.
> The only thing I've found so far is these directions for
> making graphics devices with the RGraphicsDevice package.
> http://www.omegahat.org/RGraphicsDevice/

That is certainly a good way to get something going quickly at least
(I used it just the other day and had something up and running in under 
an hour, based on the inst/examples/SVG/svgDev.R example)

> Could someone point me to any other resources? Or just
> some documentation about how to edit base R? If I don't
> get anything, I'm just going to stare at the grDevices
> section of the R source code (src/library/grDevices/src)
> until I figure out how it works.

The "canonical" approach is to look at the source code for one of the 
built-in devices in the R source code and change it to do what you want 
(e.g., src/modules/X11/devX11.c).  The file 
src/include/R_ext/GraphicsDevice.h has comments describing how the 
graphics device should be set up.  See the RSvgDevice package for an 
example of a device implemented in a package.


> In case you're curious, I want to make a graphics device
> that saves the graph in Hewlett-Packard Graphics Language.
> https://en.wikipedia.org/wiki/HPGL
> Thanks
> Tom
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz

More information about the R-help mailing list