Error in grid.Call(L_textBounds, as.graphicsAnnot(

2020-01-26 08:01发布

I just installed RStudio on Mac OS X, version 10.7.3. After executing the following commands

library(ggplot2)
qplot(mpg, wt, data=mtcars)

I get the following error:

Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  : 
  Polygon edge not found
In addition: Warning messages:
1: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  no font could be found for family "Arial"
2: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  no font could be found for family "Arial"

How do I fix this?

标签: r ggplot2
11条回答
混吃等死
2楼-- · 2020-01-26 08:10

For mac operating system, i tried many options but in the end following worked. - open font book and remove disable (enable) arial fonts. - restart the computer.

查看更多
一夜七次
3楼-- · 2020-01-26 08:11

I encountered a similar problem using the function:

ggarrange (ggpubr package)    

It was solved by manually deactivating and activating the package (by clicking on the package in "packages"). Maybe this also helps others :)

查看更多
混吃等死
4楼-- · 2020-01-26 08:12

this happened to me and i discovered that the arial font file had been disabled. first check to see if Arial.ttf has been moved to the disabled fonts directory. from the terminal:

ls /Library/Fonts\ Disabled

if so, move it back to the active fonts directory.

sudo mv /Library/Fonts\ Disabled/Arial.ttf /Library/Fonts

log out, log in, then open the 'Font Book' application. in my case, arial was present before hand, but it was the Microsoft version stored in /Library/fonts/Microsoft/. Font Book may now show a yellow triangle next to the font name, indicating that multiple copies of the font exist. highlight the font name and chose the Resolve Duplicates command from the Edit menu. this should disable the Microsoft copy, which you can confirm by selecting one of the arial type faces (click the expand triangle next to the font name), right-click on the one labelled Off, and choose Reveal in Finder, which should open a window to Microsoft fonts directory.

查看更多
闹够了就滚
5楼-- · 2020-01-26 08:16

So I bumped into the same problem with a code that was working just a few weeks before, and no massive update of anything on the computer (except maybe the OS, now that I get to think about it...). The way I solved it is that I forced the graphic window to open first by calling

quartz()

before my graphs, and it did the trick. Still unsure about the font, I seem to have the Arial in place.

查看更多
我想做一个坏孩纸
6楼-- · 2020-01-26 08:16

I just ran into the same problem after updating my OS and a fresh install of MS Office, which seems to be the culprit.

Since I couldn't get the terminal approach to work, I simply went straight to the Font Book and enabled the disabled fonts (Arial, Times New Roman, Verdana) manually. After restarting, everything seems to be working fine now.

This strikes me as the most naïve solution but it's also easiest to implement imho.

查看更多
神经病院院长
7楼-- · 2020-01-26 08:18

I ran into the same problem (interestingly, I received the error when calling the "spplot" function rather than any of the ggplot2 functions). Because I had recently installed MS Office for Mac, I tried disabling the MS duplicate Arial font as was previously suggested, but still received the error message repeatedly even after doing this. I ended up simply removing all MS Office duplicate fonts (Go-->Computer-->Macintosh HD--->Library-->Fonts and then move the Microsoft folder to the trash). I'm not sure what effect this will have on my MS applications, but it seems to have remedied my R issues, which is more important to me at this point anyway!

查看更多
登录 后发表回答