[Rd] palette bug (PR#7780)

paul at stat.auckland.ac.nz paul at stat.auckland.ac.nz
Thu Apr 7 23:33:14 CEST 2005


Full_Name: Paul Murrell
Version: 1.9.* and up at least
OS: doesn't matter
Submission from: (NULL) (130.216.50.118)
Submitted by: paul


As reported by Earl Glynn, if you do the following ...

n <- 5
par(mfrow = c(2,2))
palette("default")
barplot(1:25,col = 1:25)
palette(rainbow(n))
barplot(1:25,col = 1:25)
palette(rgb((0:15)/15, g=0,b=0, names=paste("red",0:15,sep=".")))
barplot(1:25,col = 1:25)

... then refresh the graphics window (e.g. resize it) all three plots end up
using the *last* palette (not three different palettes as originally drawn).

This is happening because the setting of the R graphics palette is not being
recorded on the R graphics display list.

Even worse, the R graphics palette is global to the R session, not per-device,
so simply recording the setting of the palette on the (per-device) display list
would only create a more subtle undesirable effect.

A possible solution is to make a per-device palette (and record the setting of
the palette on the display list).

Paul



More information about the R-devel mailing list