12

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?

Cookie
  • 957

4 Answers4

8

Had the same problem with R4.0 on Ubuntu 18. Installing the packages “gsfonts-x11”, “xfonts-base”, “xfonts-scalable”, “xfonts-100dpi” and “xfonts-75dpi” fixed the problem for me.

Thanks to Pepe_Le_Pew for the solution

7

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
6

@Garini's answer solved this issue for me. And, to expand on @Garini's answer, you can add

options(bitmapType="cairo")

to your ~/.Rprofile file to have this option enabled every time you load R without the need to remember to add it to each script.

kubu4
  • 61
5

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

options(bitmapType="cairo")
Garini
  • 151