[Rd] x11 colortype problems ('gray' is broken?) (PR#512)
Prof Brian D Ripley
Sat, 8 Apr 2000 11:31:15 +0100 (BST)
On Fri, 7 Apr 2000 email@example.com wrote:
> I occasionally run out of color in my X11 terminal. At this
> point, R will issue this error message:
> Error: X11 cannot allocate additional graphics colors.
> Consider using colortype="pseudo.cube" or "gray".
> An immediate x11(colortype="pseudo.cube") doesn't work as the
> colortype seems to be shared among the different x11 plotting windows.
> So I have to close all windows first, then I can open an x11 device
> with the colortype "pseudo.cube". (Neither the necessity to close all
> windows nor the fact, that colortype is an option to X11 and not to
> the plot command, is clear from the help pages or the error message.)
There is a single colortype shared by all x11 devices. That couild eb
> The real problem, however, comes with x11(colortype="gray") as this
> brings up just a black screen (and it stays black). I can't quite see
> whether I'm stumbling across some issues with X resources, here.
> x11() usually gives a white background.
No. It's a bug. When you set x11(colortype="gray") it tries to allocate
min(256, 2^depth) colours, that is all the colours on an 8-bit display.
That is clearly going to fail (unless perhaps your window manager is
in mono). So it does fail, set PaletteSize = 0, and then maps all
colours to black. That's what the x11 driver seems to do when colour
allocation fails. I suspect it should not open at all under those
static void SetupGrayScale()
PaletteSize = 0;
if (depth > 7)
depth = 7;
if (GetGrayPalette(display, colormap, 1 << depth) == 0)
depth = 1;
(8 replaced by 7) in devX11.c. I'll commit a more sophisticated one
Brian D. Ripley, firstname.lastname@example.org
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-devel 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: email@example.com