0

I updated Rstudio to 2022.02.3 build 492 on my MacBook Pro w/ M1 chip and find that Rstudio won't create ggplot2 plots. The following simple graph won't complete.

library(ggplot2)
library(dplyr)

aa <- tibble(a=1:100, b=runif(100))

aa %>%
  ggplot() + 
  geom_line(aes(x=a,y=b))

I updated to the latest base R to solve the issue, but it did not resolve the problem.

R.version _
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 2.1
year 2022
month 06
day 23
svn rev 82513
language R
version.string R version 4.2.1 (2022-06-23) nickname Funny-Looking Kid

EDITED: Running the few lines of code above on the R command line does not solve the problem. This suggests it's an R issue (and not related to Rstudio).

Does anyone have any suggestions that might help me figure out why this is occurring or how to resolve this issue?

UPDATE: I've installed the latest base R and Rstudio and rebooted. I now receive the dreaded "Error in grid.Call" message when I try to generate the graphic.

From Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : Polygon edge not found

it seems the issue is that R can't access to Arial font, for some reason. The very last comment in that post is key. It suggests adding +theme(text=element_blank()) [removing all text from the plot].

A graphic is generated, confirming the font issue. The problem is none of the suggestions that post seem to clear the problem.

JFD
  • 193
  • 1
  • 11
  • Does base r plot work? Say plot(1:100, runif(100)) – Hugh Jul 04 '22 at 20:51
  • Nope. Same behavior as when I run my code on the R command line. No graph appears. – JFD Jul 04 '22 at 23:42
  • It seems to not be a ggplot issue then. I doubt I can fix it because it's probably something peculiar to your installation. What is the output of `capabilities()` and `dev.cur()` ? – Hugh Jul 05 '22 at 01:33
  • Perhaps you could try different settings in RStudio under General > Graphics > Backend. – Caspar V. Jul 05 '22 at 01:54
  • @Hugh Not sure the best way to show the output. So, capabilities() jpeg png tiff tcltk X11 aqua http/ftp sockets libxml fifo TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE cledit iconv NLS Rprof profmem cairo ICU long.double libcurl TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE – JFD Jul 05 '22 at 14:39
  • @Hugh dev.cur() null device 1 – JFD Jul 05 '22 at 14:39
  • See my "UPDATE" in the original post. – JFD Jul 05 '22 at 16:47
  • After digging around using Google to find a solution, I tried installeding the "showtext" package, and running showtext_auto() inside my script. This solved the problem and the graphic was generated properly. – JFD Jul 05 '22 at 19:45
  • Alas, I restarted my machine, and loading the showtext library and running "showtext_auto()" does solve the problem of the simple plotting script. However, a more complicated script does not yet work. – JFD Jul 05 '22 at 23:39
  • This answer worked for me: https://stackoverflow.com/a/73081500/11610199 Restart mac in safe mode. Then go back to normal mode. Weird. – Kene David Nwosu Oct 09 '22 at 12:53

0 Answers0