当我在 中制作图形时R
,我使用特定的美学设置。将图形另存为可PDF
保持几乎所有元素的质量。但是当我复制图形时,metafile
为了在或文档clipboard
中使用它们,我失去了所有质量,即使我将文档另存为.doc
.docx
PDF
library (ggplot2)
Source <- c(rep("Water", 12), rep("Oil", 12))
Range <- rep((c(rep("First", 4), rep("Second", 8))),2)
Xaxis <- c(0,1,2,5,0,1,2,5,10,20,30,40,
0,1,2,5,0,1,2,5,10,20,30,40)
Yaxis <- c(0,1,2,5,0,1,2,5,10,20,30,40,
0,1,2,5,0,1,2,5,10,20,30,40)
DF <- data.frame(Source, Range, Xaxis, Yaxis)
#plot
p <- ggplot(data = DF, aes(x = Xaxis, y = Yaxis)) +
geom_smooth(method = "lm") +
geom_point() +
facet_grid(Range~Source,
scales = "free")
#Aesthetic settings
theme_set(
theme_bw() +
theme(line = element_line(colour = 1, size = 0.125),
rect = element_rect(colour = 1, size = 0.125),
text = element_text(colour = 1, size = 8),
axis.title = element_text(face="bold", size = 8),
axis.text = element_text(colour = 1, size = 8),
axis.ticks = element_line(colour = 1),
legend.title = element_text(face="bold", size = 8),
legend.title.align = 0.5,
legend.background = element_rect(fill = NA),
legend.box.background = element_rect(colour = 1),
panel.border = element_rect(colour = 1),
strip.background = element_rect(colour = 1),
strip.text = element_text(colour = 1, size = 8))
)
update_geom_defaults("point", list(size = 0.8))
update_geom_defaults("smooth", list(size = 0.125))
update_geom_defaults("linerange", list(size = 0.125))
p
在 R Studio 内部查看器中
绘图作为元文件复制到剪贴板并粘贴到.docx
文档中