Any new insights on "grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : polygon edge not found" ?


I know I brought it up before, and claimed that it was solved, but apparently it wasn't:

I keep getting the
"Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found"

at what seems to be random times during R sessions that use ggplot2;
once it happens, I can no longer plot ggplot2 objects on any R sessions that I have open, as well as new one that I open --- either from R studio or from the shell.

A few points that may be relevant

  • I am running on a Mac;
    the window (charting devices, listed via dev.list) is therefore Quartz

  • Once I encounter the problem, I cannot plot any ggplot object --- even the simplest chart object created via ggplot(data.frame(), aes(x=1,y=1)) + geom_point()

  • Closing all running RStudio windows, and all R shell sessions and then relaunching them, does not help. The only way I manage to get back the plotting functionality is by restarting my Mac, which is quite painful given all processes that are running in the background (not just R scripts).

  • It seems like the Quartz window system is functioning as expected for non R plotting purposes; e.g., if I run xclock, a new Quartz window is open showing the clock, as expected. So it looks like it does have something to do with mapping the x/y values to the graphic device (I am not sure about the latter, it is just my interpretation of the error language)

  • I do not know what triggers the problem, there is no specific event or code that seems to consistently occurs prior to seeing this error.

    • The last time that it happens was after I dragged one of the Quartz windows between different displays, specifically from my iMac to the sidecar display running on my iPad. It definitely occurred before even when using only my single iMac screen.

    • I do have, though, multiple desktops that are used, and R sessions, including associated Quartz windows, scattered among them. I usually have at least 3 - 4 Quartz windows (one per R session) open in addition to the built in plot pane in RStudio.

The only thing that comes to mind that may be common to all cases where I encounter the problem is that there was an instant of RStudio open; that is, I don't recall ever seeing the problem when only using R from the command line; the built in Plot pane in RStudio was always active, but as said, once it happens, the problem is not restricted to this pane --- I can no longer plot any ggplot object on any window.

If anyone have any insights or suggestions of how to eliminate the problem and get back to being able to plot ggplot objects once the problem occurs --- other then restarting the Mac --- I will highly appreciate your help. I deferred putting this additional post for quite a while as I wanted to see if the problem persists, but unfortunately it does happen every 2-3 weeks and I still have no idea what triggers it, and worse, how to handle it once it is triggered.
This problem is by far the most frequent cause to restart my Mac -- otherwise it would run for months without anything requiring a restart, and it becomes quite frustrating.


1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.