Hi all,
Executive summary:
- The old
Error in grid.call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, polygon end not found
in the middle of the day, while I was not interactively using my Mac - It happens both from within RStudio, and when running R interactively via the shell
Details below
I am using ggplot2 on a regular (well, hourly) basis, both from within RStudio and from the external R command line (interactive, called from a shell).
Something weird just happened. All running sessions that generates plots (automatically, every few minutes) exited with this error message:
Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
For context, I am running the new RStudio 1.3.820 on MacOS (Catalina 10.15.2), with R version 3.5.1.
This is a very old problem that was addressed before (FWIW, I never saw a description of what exactly was done to address it (the R code), which may be relevant to me as I am using R not just from within RStudio)
What is very surprising/puzzling to me is that it all happened at exactly the same minute 3:32pm EDT to be exact. It happened concurrently on R commands running from shell, and from within an RStudio job.
What's even more surprising is that I did not (actively) use my Mac at that point. It was running these jobs as usual, and when I looked at it at 4pm I noticed that all sessions generating plots got this error. Any additional attempts to generate new charts failed with the same error.
The simplest charting attempt will reproduce the error; you don't need anything more sophisticated then:
> data.frame(x=1:9,y=1:9) %>% ggplot(aes(x=x,y=y)) + geom_line()
Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
The following two observations may shed some light:
- Piping the chart to ggplotly generates and perfectly accurate chart:
{data.frame(x=1:9,y=1:9) %>% ggplot(aes(x=x,y=y)) + geom_line()} %>% ggplotly(dynamicTicks = T)
- At least when tested from the shell, running
extra_font::font_import()
seemed to solve the problem for charting instance, but then the problem came back.
I went through all the old blogs discussing this problem, but did not find anything that could explain this.
Will very much appreciate any insight / solution to this. My only workaround at the moment is to pipe everything through plotly
, but I do need the charts saved (in files) and rather have them saved also in a regular RDS file as a ggplot2 object, and not just as plotly object that requires a web browser to examine outside of RStudio (I am now always near my machine when I need to look at these files).
Thanks