'Error in grid.Call

while trying to generate any plot using ggplot2, the following error is given:

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

I already searched the web, any remotely related post didn't solve the issue. The simple example that I'm trying to plot is :

f = data.frame(one = c(1:5), two = c(6:10))
ggplot(f, aes(one,two)) + geom_point()

I updated my ggplot2 (ggplot2_3.0.0) yet it is still not working.

Edit: I'm working on ubuntu, and in the terminal, i.e. no Rstudio



Solution 1:[1]

> capabilities()

sudo apt-get install libcairo2-dev libgtk2.0-dev

This may caused by cairo

Solution 2:[2]

In ubuntu 18.04 the problem can appear again. It was enough, in my case, to indicate the right bitmap (i.e. "cairo").

options(bitmapType="cairo")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shixiang Wang
Solution 2 Garini