[Rd] par(mfg=) and postscript and pdf
Marc Schwartz
MSchwartz at mn.rr.com
Fri Jan 20 14:48:59 CET 2006
On Fri, 2006-01-20 at 07:47 +0000, Prof Brian Ripley wrote:
> This is related to the incorrect bug report PR#7820. Marc Schwartz
> pointed out in
>
> https://stat.ethz.ch/pipermail/r-devel/2005-April/033016.html
>
> an example of a real problem. If you call par(mfg=) after par(mfrow) (or
> mfcol) and before you have done any plotting, NewPage is not called on the
> device at the start of the first page. That causes the DSC comments to be
> incorrect on postscript() and much worse on pdf().
>
> You would get the same effect by calling par(new=T) before plot.new() is
> called, except that is disallowed. par(mfg=) does set new=T internally,
> and also sets the plot number to a valid one, both of which inhibit
> calling NewPage. I've managed to overcome this by ensuring that
> GNewPage always calls NewPage on an unused device (there is an internal
> 'state' variable which records the latter).
>
> This is safe in the sense that the worst it could do is to produce an
> unwanted new page. I can't see how this could happen but the design of
> the internals of base graphics is very complicated and undocumented, so I
> am only putting the change in R-devel (along with fixes to the
> long-standing graphics bugs PR#1235 and PR#2630).
Prof. Ripley,
Thanks for your follow up on this issue. Your efforts in resolution are
greatly appreciated.
Best regards,
Marc Schwartz
More information about the R-devel
mailing list