[R] Help me understand colours on linux

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Wed May 30 11:29:56 CEST 2007


Here is my sessionInfo():

Version 2.3.1 (2006-06-01) 

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
[7] "base"     

I have a function that is trying to draw rectangles using 136 different
colours, and I get the following error:

Error in rect(xstart, my.min, xstart + fcount[i, 2], my.max, col =
fcolors[i],  : 
        Error: X11 cannot allocate additional graphics colours.
Consider using X11 with colortype="pseudo.cube" or "gray".

However, if I use "pseudo.cube" I don't get anywhere near enough
distinct colours.  I could use gray, but I would prefer colour.  So,

1) is there any set of options I can use which will actually let me
create that many colours?
2) if not, how do I test if there is not, and implement gray instead of
colours?  This function and package works on windows, and it works with
less colours.  I guess I could try and trap the error, and if I can, go
back and re-run the function with "options(X11colortype="gray")" but I'd
prefer something more elegant... What I'm looking for is some test where
I can say "If you're going to fail, X11colortype='gray', else
X11colortype='true'".  Possible?

Many thanks

The information contained in this message may be confidentia...{{dropped}}

More information about the R-help mailing list