0

我想导出我在ggplot2.

我试过重新安装svglite和安装,dependencies = TRUE但我仍然遇到同样的错误。

我正在使用ggplot2,reshapesvglite:

library(ggplot2)
library(reshape2)
library(svglite)

我生成了一个包含我的图像的变量:

image = ggplot(new.df) + geom_tile(aes(x=algorithm, y=name, fill=solved == "0")) + scale_x_discrete("") +
  scale_y_discrete(limits = rev(levels(df$name))) + scale_fill_manual(values = c("#33DD33", "#DD3333"), na.value="gray50") +
  theme(axis.text.x = element_text(angle = 90), legend.position="none")

我执行以下行:

ggsave(file='~/Desktop/eterna100_51-100_ordered_TEST.svg', plot=image, device = "svg")

但是,我收到此错误:

Error: package or namespace load failed for ‘svglite’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so, 6): Library not loaded: /opt/X11/lib/libcairo.2.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so
  Reason: image not found
4

1 回答 1

0

您应该下载 XQuartz https://www.xquartz.org/并重试。svglite 与 XQuartz 有一些依赖关系。

于 2019-01-12T21:42:00.600 回答