5

I am on Ubuntu 13.10, with R version 3.1.0 beta (2014-03-28 r65330) -- "Spring Dance" (64 bit).

It is a new install and when trying to plot I am getting above error message

Error in title(main = "Test", line = -1) :

X11 font -adobe-helvetica-%s-%s---%d-------*, face 2 at size 11 could not be loaded

This is happening with X11(type="Xlib")

I looked around a bit, but could only find quite old threads. Prof. Ripley replied to a similar issue in 2013 with

See ?X11 and the 'R Installation and Administration Manual'. You are dragging up ancient history (2002). The 'modern' X11 device (from 2007) uses cairographics and does not use X11 fonts. I suggest you take a look at how R was built and ensure that the cairo-based device is available. Further, for a long time most X11 installations have been from Xorg and not Xfree86, and do not generally have a config file.

That unfortunately doesn't help me, because I am using events:

setGraphicsEventHandlers(prompt="Click and drag to zoom, hit q to quit",
                           onMouseDown = dragmousedown,
                           onMouseUp = mouseup,
                           onKeybd = keydown)
eventEnv <- getGraphicsEventEnv()
getGraphicsEvent()

And those aren't supported on any other device. It is still working on my other machine, so I presume I just need to find fonts somewhere.

How do I install or generate those fonts on Ubuntu?

  • 1
    Just as a quick tip, I installed pretty much a gazillion fonts, only to realize that I needed to restart the computer as well - one of them fixed it. As an aside, maybe there is a way of loading new fonts without restart? That would be nice... – Cookie Apr 21 '14 at 7:41
  • 1
    xset fp rehash tells the X server to rescan the directories in its font path for newly installed fonts (if the font was added to a directory already listed in the font path, and mkfontdir was run to update the fonts.dir files to list it). – alanc May 31 '14 at 19:15
  • I followed @user3002067 's suggestion and then ran xset fp rehash and then mkfontdir after. The issue persisted for me. Then I rebooted my system as suggested by @Cookie and then things started working for me. – ohnoplus Nov 9 '18 at 23:13
3

I got this same issue using R in Ubuntu 14.04 specifically with the GGALLY package and the GGPAIRS function. To recreate:

data(mtcars)
library(GGally)  
mtcars_subset <- mtcars[,c(2:11)]
ggpairs(mtcars_subset)

Error:
Warning message:  
Error in grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,  : X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 16 could not be loaded

To fix this loaded the following and rebooted Ubuntu:

sudo apt-get install t1-xfree86-nonfree ttf-xfree86-nonfree ttf-xfree86-nonfree-syriac xfonts-75dpi xfonts-100dpi
0

In ubuntu 18.04 the problem can appear again. It was enough, in my case to indicate the right bitmap.

options(bitmapType="cairo")

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.