11

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?

3
  • 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, 2014 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, 2014 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, 2018 at 23:13

4 Answers 4

7

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

1
  • The solution proposed is in the sentence "Installing the packages..." The link is merely attribution for the source of the information.
    – CentaurusA
    Jan 24, 2020 at 1:58
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.

1
  • This would've been nice under the said answer as a comment... But I get it, your reputation points. Nov 1, 2021 at 19:39
5

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

options(bitmapType="cairo")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .