[R-pkg-devel] Setting graphics device-copy parameters

Neal Fultz n|u|tz @end|ng |rom gm@||@com
Wed Jun 17 20:25:18 CEST 2020


I'm working on a graphics device in a R package, and need to set some
graphical parameters for
text / labels on the devices as they are initialized or reset.

This feature is described in R Internals:

> The three copies of the GPar structure are used to store the current parameters (accessed via gpptr),
> the ‘device copy’ (accessed via dpptr) and space for a saved copy of the ‘device copy’ parameters.
> The current parameters are, clearly, those currently in use and are copied from the ‘device copy’
> whenever plot.new() is called (whether or not that advances to the next ‘page’). The saved copy
> keeps the state when the device was last completely cleared (e.g. when plot.new() was called
> with par(new=TRUE)), and is used to replay the display list.

How do I, from a package, actually access and initialize the "device copy" ?

All I've been able to find is a comment containing an older,
copy-pasted comment in GraphicsDevice.h :

>  * 2. I found this comment in the doc for dev_Open -- looks nasty
>  *    Any known instances of such a thing happening?  Should be
>  *    replaced by a function to query the device for preferred gpars
>  *    settings? (to be called when the device is initialised)
>          *
>          * NOTE that it is perfectly acceptable for this
>          * function to set generic graphics parameters too
>          * (i.e., override the generic parameter settings
>          * which GInit sets up) all at the author's own risk
>          * of course :)


Thanks,

Neal



More information about the R-package-devel mailing list