Include Cairo R on a MAC

include cairo R on a mac

You should download X11 for Mac, which is called XQuartz. It doesn't ship with OS X any more, so you have to download it separately from: https://www.xquartz.org/

Error in Installing the Cairo R Package

A coworker and I just fixed the problem by ignoring all of what I typed above. Rather, we installed Cairo and all of its dependencies from source manually, thereby bypassing the usage of brew or variants like port. This worked like a charm, so I am not entirely sure what was wrong above.

How to fix failed to load cairo DLL in R?

I only have a Windows machine to offer, but the following worked for both saving a .svg and .eps of your cowplot (after installing the package svglite):

# install.packages(svglite)
library(tidyverse)
library(cowplot)

d <- sample_n(diamonds, 50)
g <- ggplot(d, aes(carat, price)) + geom_point()
gg <- list(g,g,g)

plot_grid(plotlist = gg, nrow=1)
ggsave(filename = "testing.svg")
ggsave(filename = "testing.eps")

You can of course modify the filename to something like "~/Desktop/testing.svg", depending on where you want to safe your plot. Note that ggsave per default saves the last active plot, and the ending of the filename you specify should automatically trigger the right device.

Homebrew R build missing Cairo

I just ran into this problem. It seems to be a problem with pkg-config locating cairo during the R configure stage. The workaround seems to be:

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

so that R can properly use cairo.

I install R directly from source, rather than with homebrew, but I do use homebrew to keep other libraries up to date. This resolves the problem for me.

For reference, I am running OSX Mavericks.

Cannot find cairo.h

If using Conda for R environments, you are better off avoiding install.packages and instead make a point to always install through Conda. CRAN's Cairo package goes by r-cairo on Conda Forge. So,

conda install -n seurat4 -c conda-forge r-cairo

Error message installing Cairo package in R

You need the development header as the file Intrinsic.h is not found.

For the related package cairoDevice (which I maintain for Debian), I ensure the following is installed:

libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base

If you are on a different distribution these might be called something else. The key is that the Gtk and Cairo header packages also pull in other, needed, x11 packages.



Related Topics



Leave a reply



Submit