On 12/12/2012 09:10, peter dalgaard wrote:

On Dec 12, 2012, at 01:48 , arun wrote:

Hi,
Try this:
  pdf("broke.pdf")
  palette(rainbow(6))
  plot(x=x1,y=y1,col=y1,xlim=c(-10,20))
  palette(heat.colors(6))
  points(x=x2,y=y2,col=y2)
  dev.off()
A.K.

Yep. Notice though that this is not specific to dev.copy2pdf, the same effect 
happens if you just resize the the screen device. Seems like palette changes 
are not recorded in the display list. Not sure whether that is by omission or 
by design.


I believe it is by design. palette() is part of package grDevices, and you should think of the palette as a per-session setting. (It is stored in R itself, not on the device and not in package grDevices.)

So plots are plotted using the last palette set in that R session, including being re-plotted.


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@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.

Reply via email to