[Rd] Error messages in replayPlot()

Paul Murrell paul at stat.auckland.ac.nz
Tue May 16 03:53:14 CEST 2017


Hi

The "figure margins too large" message is suppressed on replay because 
that replay code is also played when resizing a graphics device (so if 
it was printed to the console you could get millions of error messages 
as you resized a window) - on replay, the message is drawn on the 
graphics device instead (take a look at the PNG that your second example 
creates), but that is not necessarily easy to access.

Paul

On 16/05/17 00:07, Jeroen Ooms wrote:
> I was wondering if there is something that can be done to improve
> error messages when replaying a recorded plot. For example a graphics
> device that is too small usually results in a helpful error message:
>
>  png(height = 100)
>  plot(1)
>  # Error in plot.new() : figure margins too large
>  dev.off()
>
> However when this happens when replaying a recorded plot, the error
> message is not so helpful.
>
>  myplot <- evaluate::evaluate("plot(1)")[[2]]
>  png(height = 100)
>  replayPlot(myplot)
>  # Error in replayPlot(x) : invalid graphics state
>  dev.off()
>
> A more informative error message that hints at what exactly is invalid
> about the graphics state would be very helpful in this case.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



More information about the R-devel mailing list