Skip to content

recordPlot in 1.5.x, replayPlot in 1.6.0 problem

5 messages · Uwe Ligges, Paul Murrell, Don MacQueen

#
I have plots that were stored using recordPlot() in a fairly recent 
but pre-1.6.0 version of R that will not replayPlot() in R 1.6.0. The 
error message is
    Error in replayPlot(x) : invalid hex digit in color or lty


The plots were stored in June (2002-6-14), each as an element of a 
list named 'rpl'. The version of R that was current then is what I 
used. At that time I was able to re-display them.

Today, in R 1.6.0, when I try to re-display them, I get an error message:
Error in replayPlot(x) : invalid hex digit in color or lty

The plots did have lines with col='blue' and lty=2 in them. This 
little snippet of code executed today works
  > plot(1:5)
  > lines(1:5,col='blue',lty=2)
  > tmp <- recordPlot()
  > tmp
so there doesn't seem to be a problem if I work entirely within 
v1.6.0. Which suggests that the problem is in going from one version 
to the next.
_
platform sparc-sun-solaris2.7
arch     sparc
os       solaris2.7
system   sparc, solaris2.7
status   Patched
major    1
minor    6.0
year     2002
month    10
day      13
language R

-Don
1 day later
#
Don MacQueen wrote:
I have tested your example with R-1.3.1 (!), R-1.5.1 (record) and
R-1.6.0, R-1.6.1 (replay) --- with success.
So it is really of interest 
 a) to get a reproducable example and/or
 b) to know what "fairly recent" means.

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1 day later
#
Thank you for responding.

I checked the dates, and "fairly recent" means R-1.5.0 in this case. 
I will try to get a reproducible example.

-Don
At 6:03 PM +0100 11/2/02, Uwe Ligges wrote:

  
    
2 days later
#
Hi
Don MacQueen wrote:
I have a reproducible example.  Try this in R 1.5.0 ...

	plot(1:10)
	temp <- recordPlot()
	save(temp, file="dl")

... then this in R 1.6.0 ...

	load(temp)
	x11()
	replayPlot(temp)  

... and the tick-marks on the axis are a bit funny (dotty).

<GORY DETAIL>
I think the problem is that the interface for the internal axis code has
changed.  In 1.5.0 we had ...

    /* axis(side, at, labels, tick,
     *	     line, pos, outer, font, vfont, ...) */

... in 1.6.0 we have ...

    /* axis(side, at, labels, tick, line, pos,
     *	    outer, font, vfont, lty, lwd, col, ...) */

What gets saved by recordPlot() is the display list which is a list of
internal C calls.  What you are seeing is the 1.6.0 code being called
with a 1.5.0 argument list and the lty, lwd, and col arguments are
missing so goodness knows where they are being taken from.
</GORY DETAIL>

In simple terms, this is a danger of trying to use display lists across
different versions of R -- the information that is stored in the display
list *may* be version-specific.  Ideally we would detect these changes
automatically -- sorting out display lists is a todo item.

In case it is of any use, I have a very basic discussion of saving and
reusing graphics output at
http://www.stat.auckland.ac.nz/~paul/grid/saveload.pdf
This is aimed at using grid, but some of it is relevant for base
graphics too.

Paul
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Paul,
Thank you for the example and the explanation.

It is not a problem for me to regenerate the display list--indeed, by 
design, they will be regenerated from time to time. So there is no 
urgency on my part to detect version changes automatically.

I'm using display lists to store large numbers of plots, and then 
using the R-TclTk library to present users with a dialog box in which 
they can press the Home, End, PageUp, PageDown keys to move through 
the plots. I was very glad when I learned of recordPlot() and 
replayPlot() and found I could use them for that purpose.

-Don
At 12:08 PM +1300 11/7/02, Paul Murrell wrote: