Skip to content

Faster Plotting in {EGAnet} (and R)

Alexander Christensen edited this page Aug 7, 2023 · 5 revisions

Everyone likes a beautiful plot but waiting to see the results can be a pain. Networks tend to take some time because every node is a point and every edge is a line.

The base graphics backend for RStudio is pretty slow. Fortunately, there is a better, faster way and its platform-independent.

The {ragg} package offers fast, clean, and beautiful plots. Since {ragg} is available on CRAN, you can install it using the conventional method:

> install.packages("ragg")

If {ragg} doesn't install successfully, then you might need to set up R with some toolchains (see Toolchain Installation).

Once {ragg} is installed, there's a bit more to do. You'll need to switch RStudio's graphics backend to {ragg}.

Here's step-by-step text instructions:

1. Open RStudio and click on the 'Tools' tab at the top
2. From the dropdown menu, select 'Global Options...'
3. Under "General", click on the "Graphics" tab
4. For the "Backend" option, select "AGG" from the dropdown menu
5. Click "Apply" in the lower right corner and then "OK"
6. Restart RStudio

Here's the same instructions in images:

Restart RStudio and you're good to go!