yes I know there are many threads to this above mentioned error, but (at least I) wasn't able to find a solution.
So RStudio gives me the following error while trying to plot something:

> 
> 
> ```
>     Error in RStudioGD() : 
>     Shadow graphics device error: r error 4 (R code execution error)
> 
> ```
> 
> 

It seems to be a problem with R supporting jpeg and png.
Running in R environment

```
    >capabilities()
    jpeg         png        tiff       tcltk         X11        aqua 
    FALSE       FALSE       FALSE       FALSE       FALSE       FALSE
    http/ftp     sockets      libxml        fifo      cledit       iconv 
    TRUE        TRUE        TRUE        TRUE       FALSE        TRUE 
    NLS     profmem       cairo         ICU long.double     libcurl 
    TRUE       FALSE       FALSE        TRUE        TRUE        TRUE 

```

shows exactly that. cairo and pango are installed. And I have no idea what else to do.
[Here](https://github.com/clauswilke/dataviz/blob/master/visualizing_uncertainty.Rmd) you can find the code I'm trying to run. I installed the packages magrittr, ggplot2, dplyr, cowplot and patchwork.
 Furthermore I'm running the latest RStudio version on linux. R itself is also updated.

Thanks in advance.

---

**EDIT**:
*For anyone stumbling over the same problem: A complete re-installation of R, RStudio and most depencies solved the problem somehow.*