【发布时间】:2024-01-12 21:39:01
【问题描述】:
问题
我想从 R 中保存 ggplot,以便在 Adobe Illustrator (AI) 中进行编辑。我可以使用ggsave 以EPS 或PS 格式保存绘图,但绘图总是在文本周围带来一些阴影。有没有办法在 R 或 Adobe Illustrator 中解决这个问题?
例如,我的plot 是这样的:
但是,当我将它导入 AI 时,它看起来像这样(文本周围的粉红色阴影):
代码
# Saving a plot for editing in Adobe Illustrator.
library(ggplot2) # for plotting
library(cowplot) # for ggsave
# Generate an example scatter plot.
# From: http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html
options(scipen=999) # turn-off scientific notation like 1e+48
theme_set(theme_gray())
data("midwest", package = "ggplot2")
plot <- ggplot(midwest, aes(x=area, y=poptotal)) +
geom_point(aes(col=state, size=popdensity)) +
geom_smooth(method="loess", se=F) +
xlim(c(0, 0.1)) +
ylim(c(0, 500000)) +
labs(subtitle="Area Vs Population",
y="Population",
x="Area",
title="Scatterplot",
caption = "Source: midwest")
plot
# Save the plot as .eps with ggsave.
file <- "myplot.eps"
ggsave("myplot.jpg",plot)
【问题讨论】:
标签: r ggplot2 adobe-illustrator cowplot