0

I am running R 4.2.2. in RStudio 2022.07.2 with Ubuntu 20.04. When I try to run a ggplot with transparency such as:

ggplot(as.data.frame(rowData(rpdata)))+
geom_density(aes(x=length, fill=status), alpha=0.5)

I receive the warning message:

    Warning message:
In grid.Call.graphics(C_polygon, x$x, x$y, index) :
  semi-transparency is not supported on this device: reported only once per page

And the output, the plot has the transparencies missing. I followed the answers suggested in Semi-transparency in RStudio about installing Cairo and setting:

options(bitmapType="cairo")

However, after running that, my RStudio crashes.

PS: if I save the plot using pdf(). the plot is correct and no error is displayed, but I want to see the correct plot directly in RStudio and then maybe save it with png().

  • 1
    Have you tried using `ragg`? It has full transparency support and very nice anti-aliasing / text handling. Do `install.packages("ragg")` in the R console, then in the RStudio toolbar, select Tools -> Global Options -> General -> Graphics and set "Backend" to "AGG". – Allan Cameron Nov 08 '22 at 12:12
  • I had some problems with the dependencies that can be solved by : `sudo aptitude install libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev`, but it worked. If you post an answer I'll validate it. Thanks! – Pau Clavell-Revelles Nov 08 '22 at 13:34

0 Answers0