Specify "AGG" as graphics device for RStudio Connect deployment

Is there a way to specify the Graphics Device backend on deploying to RStudio Connect? I have a working ggplot that displays locally after setting "AGG" as the backend Graphics Device (i.e. using the ragg package).

I have tried specifying options(shiny.useragg = TRUE) in my .Rprofile that goes with the deployment, but the rendering still isn't working correctly.

RStudio Connect Deployment:

Local Working Render:

Thank you for any insights.

The ragg package is a suggested dependency of Shiny, not a strict dependency. Do you have a library(ragg) statement in your code or have some other explicit reference to ragg?

You'll also want to make sure that your Connect server has the ragg system dependencies installed; they're listed here: Posit Package Manager

We toyed with the idea of forcing a ragg dependency in the rsconnect 0.8.27 release, but rolled that back in rsconnect 0.8.28 because too many environments lacked the ragg system dependencies.

Hi aron, thanks for the reply. library(ragg) was included at the top of the boilerplate shiny app (with just a slight modification to display my plot instead of the usual Old Faithful histogram). I'm reaching out to our Connect admin to see if they can confirm the dependency installation. Is there any other information I can provide them that they can look into?

The font choices are likely to be different on the Connect (Linux) server compared to your development environment. Unfortunately, I don't have any specific advice about font installation.

You may want to try calling systemfonts::system_fonts() from your content to determine what fonts are available on the remote system.

The ragg documentation does show an example that chooses a different font on Linux; you may need something similar. GitHub - r-lib/ragg: Graphic Devices Based on AGG

Hope this helps.

@aron I haven't gotten a confirmation yet from my Connect admin, but I also tested this on shinyapps.io and it doesn't render correctly there either: ggswim

I would have expected it to, unless there's some way to specify graphics device settings on deployment? I already have options(shiny.useragg = TRUE) set in the .Rprofile that accompanies the deployment.

@aron Do you know if installation of the libagg-dev Ubuntu package could be the culprit on the Connect server?

Unfortunately, I don't know enough about the internals of ragg to say what might be happening. Have you tried enumerating the available fonts by adding a call to systemfonts::system_fonts() from your content?

Since this problem is also happening on shinyapps.io, could you file a ragg issue with a minimal Shiny application showing the problem?

I did, but I'm not very sure what to look for other than that there ~500 on my system and ~100 on the Posit connect server.

I'll looking into filing a ragg issue as well, thanks.

The ragg authors were able to help me find a solution for Posit Connect. More can be found here.

In short, installing the fonts-noto-color-emoji library on the Connect server allowed our emojis to render online.

This topic was automatically closed 7 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.