[R] Error: X11 cannot allocate additional graphics colours.

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Tue Oct 16 11:34:53 CEST 2007


Thank you for all your responses.

For the font problem, all I need is someone to tell me *which* font libraries I need to install.  I can seek local help from my Sys Admin, only they will just ask "Which fonts would you like to install?" and I will be back at square one.

Yesterday, I installed these fonts:

http://download.savannah.nongnu.org/releases/freefont/freefont-ttf-20060126.tar.gz

And then I installed these fonts:

http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts.tar.gz

I know the font problem is on the server as when I run a script on the server itself, the fonts do not appear.  The CGI I was referring to is apache and perl on the server, connecting using http and internet explorer to port 80.

I realise this is mostly an X/linux problem, but R is looking for some fonts and not finding them and R-help is the only place that I can find out *which* fonts it's looking for.

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: 16 October 2007 07:29
To: michael watson (IAH-C)
Cc: Paul Gilbert; r-help at r-project.org
Subject: Re: [R] Error: X11 cannot allocate additional graphics colours.

On Mon, 15 Oct 2007, michael watson (IAH-C) wrote:

> Thank you both.
>
> I use R on linux both remotely (over CGI) and I log in using Exceed from windows.  The problem occurs over both.

The latter may explain the font problem: it is a crucial fact.  The X 
server is running on the Windows box, not on RHEL4, so it is the Exceed 
settings that count.  The penultimate time I tried this, Exceed had no 
iso10646 fonts.  I did update Exceed a couple of months ago, and it found 
some which worked for ASCII but practically nothing else.

I don't know what you mean by 'over CGI'.  Some scenarios for running 
remotely run the X server on the client but most run it on the server: the 
latter may well have limited bit depth by default, as e.g. Xvfb and 
rdesktop too.

I would be seeking local help on the system setup rather than asking on 
R-help about X11 issues.


>
> I don't run Xvfb (though I can do as I have done in the past).
>
> I have root priveleges so I will look and see what the settings are, though I don't think my pet sys/admin will have changed the defaults....
>
> ________________________________
>
> From: r-help-bounces at r-project.org on behalf of Paul Gilbert
> Sent: Mon 15/10/2007 10:13 PM
> To: r-help at r-project.org
> Subject: Re: [R] Error: X11 cannot allocate additional graphics colours.
>
>
>
> (This could be fixed, it has not happened to me in a long time, but I
> will mention it mainly because it is not something you are likely to
> think of.)
>
> It used to be that the X colours might be defined by the first
> application that needed them, so if the systems administrator happened
> to start up X and mozilla on the server, especially if the server had
> limited graphics, then that could potentially cause this problem. I
> never really understood why it would be like this, so probably it is
> fixed. (This was not an R bug.)
>
> Paul
>
> Marc Schwartz wrote:
>> This is not a X server version issue.
>>
>> There are Linux system (not R) display settings that will dictate the
>> number of simultaneous colors that can be displayed. This will be
>> dependent upon the display resolution defined and the amount of video
>> RAM on the graphics card. The higher the display resolution the more
>> video memory it takes since you have more pixels. The more colors you
>> want to display simultaneously, the more memory per pixel it takes.
>>
>> Those concepts, BTW, are the same on Windows and OS X.
>>
>> So if you are running directly on the RHEL system, check the display
>> setting to be sure that it is set for a sufficient number of colors.
>> This would be an administrative task requiring root privilege. Ideally,
>> you want so-called TrueColor or "Millions of Colors" to be set. This
>> requires a pixel depth of 24 bpp or 32 bpp, depending upon VRAM
>> available.
>>
>> On the other hand, if you are connected remotely to the RHEL server,
>> using ssh and Xvfb on a server that is not running X, then you will need
>> to adjust (or have the SysAdmin adjust) the -pixdepths setting on the
>> RHEL server. This controls the 'bpp' available on the server.
>>
>> See 'man Xvfb' for more information for the latter scenario.
>>
>> HTH,
>>
>> Marc Schwartz
>>
>> On Mon, 2007-10-15 at 20:53 +0100, michael watson (IAH-C) wrote:
>>> Thanks for the response...
>>>
>>> My confusion about plot stems from the fact I am plotting 82 points
>>> with 82 colours, so surely all colours get plotted?
>>>
>>> As for updating X, I recently installed the latest version of XFree86
>>> for my version of linux, RHEL 4.
>>>
>>> As for Brian's e-mail you quoted, I do try and look at things like
>>> that, but I don't know what arguments he refers to:
>>>
>>> "Run the X11 device with the arguments stated"
>>>
>>> Which arguments, and how do I run my X11 device with them?
>>>
>>> I've pretty much had this problem with every version of R on linux,
>>> all the way from SuSe 8.2 to SuSe 9.2, through to RHEL3 and now RHEL4
>>> - I always have this problem.
>>>
>>> Perhaps you could tell me which version of X you use to generate 1000
>>> colours without getting the error message?  I'm sorry, but what i
>>> would really love is someone to say "RHEL4?  Aha , you need to install
>>> X version foo, available from http://www.foo.com/bar.rpm...)
>>>
>>> -----Original Message-----
>>> From: Charles C. Berry [mailto:cberry at tajo.ucsd.edu]
>>> Sent: Mon 15/10/2007 7:54 PM
>>> To: michael watson (IAH-C)
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] Error: X11 cannot allocate additional graphics colours.
>>>
>>>
>>> You knew this?
>>>
>>>      http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0640.html
>>>
>>> I cannot replicate your error. I use n <- 1000 on R-2.6.0, and it still
>>> works.
>>>
>>>
>>> Only a guess, but maybe your X setup is out of date. Maybe an update would
>>> help?
>>>
>>> As for why axis triggers this, axis uses all the colors, but image only
>>> uses (something like) those that fall into the bins shown here:
>>>
>>>      hist( mat, breaks=n )
>>>
>>>
>>>
>>> As you see there are usually some empty bins and those colors do not get
>>> rendered till axis() does its thing.
>>>
>>> Chuck
>>>
>>> On Mon, 15 Oct 2007, michael watson (IAH-C) wrote:
>>>
>>>> Dear All
>>>>
>>>> Another one I have touched on before with a much older OS and version.
>>>>
>>>> My sessionInfo() is:
>>>>> sessionInfo()
>>>> R version 2.5.1 (2007-06-27)
>>>> i686-redhat-linux-gnu
>>>>
>>>> locale:
>>>> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.U
>>>> TF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-
>>>> 8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_ID
>>>> ENTIFICATION=C
>>>>
>>>> attached base packages:
>>>> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"
>>>> "methods"
>>>> [7] "base"
>>>>
>>>> other attached packages:
>>>> DetectiV
>>>>   "1.1"
>>>>
>>>> I'm getting the following error message when plotting a quite complex
>>>> graph:
>>>>
>>>> Error in axis(side = 2, at = c(min[i] - sptl, max[i] + sptl), labels =
>>>> NA,  :
>>>>        Error: X11 cannot allocate additional graphics colours.
>>>> Consider using X11 with colortype="pseudo.cube" or "gray".
>>>>
>>>> The problem is I only get it under certain circumstances.  I have some
>>>> quite convoluted test code:
>>>>
>>>> n <- 82
>>>> mat <- matrix(rnorm(n*10), ncol=n)
>>>> fcolors <- terrain.colors(n)
>>>> image(z=mat, axes=FALSE)
>>>> oneis <- 1 / ncol(mat)
>>>> sptl <- oneis / 3
>>>> max <- 1:n * oneis
>>>> min <- c(0, max[1:length(max)-1])
>>>> for (i in 1:n) {
>>>>     axis(side=2, at=c(min[i]-sptl,max[i]+sptl), labels=NA, line=0.9,
>>>> lwd=3, lty=1, tick=TRUE, tck=0, col=fcolors[i],lend=2)
>>>> }
>>>>
>>>> Now, this code works without error on values of n up to and including
>>>> 81, but produces the error when it is 82:
>>>>
>>>> Error in axis(side = 2, at = c(min[i] - sptl, max[i] + sptl), labels =
>>>> NA,  :
>>>>        Error: X11 cannot allocate additional graphics colours.
>>>> Consider using X11 with colortype="pseudo.cube" or "gray".
>>>>
>>>> The issue I have with it is that if I do a normal plot operation, I
>>>> don't get the error!
>>>>
>>>> n <- 82
>>>> fcolors <- terrain.colors(n)
>>>> plot(1:n,1:n, col=fcolors)
>>>>
>>>> Here the plot works, there are no errors and the colours come out fine.
>>>> But when I use the axis command, in the more complex code above, I get
>>>> an error.
>>>>
>>>> The real question I want to know is how can I enable R (or my OS) to
>>>> plot a greater number of colours?  I can plot 820 colours on R under
>>>> windows, probably more, I just plucked 820 out of the air.  I'm guessing
>>>> this is because my windows graphics card can produce that many colours,
>>>> whereas on linux I am limited by what x-windows can produce, but there
>>>> must be some way of increasing the number of colours I can plot using R
>>>> under linux...?
>>>>
>>>> Many thanks
>>>> Mick
>>>>
>>>> The information contained in this message may be =\ co...{{dropped:20}}
>>> ______________________________________________
>>> R-help at 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.
>>
>> ______________________________________________
>> R-help at 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.
> ====================================================================================
>
> La version française suit le texte anglais.
>
> ------------------------------------------------------------------------------------
>
> This email may contain privileged and/or confidential in...{{dropped:26}}
>
> ______________________________________________
> R-help at 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.
>
> ______________________________________________
> R-help at 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.
>

-- 
Brian D. Ripley,                  ripley at 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



More information about the R-help mailing list