R图中出现奇怪的线 [英] Weird lines appearing in the R graph

查看:50
本文介绍了R图中出现奇怪的线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要提交研究论文的期刊要求文章必须以PDF格式提交.我正在使用R进行统计和绘制图形.

Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs.

我使用基本公式来打印图形.在VennDiagram包中,barplot()用于条形图,boxplot()用于框线图和draw.triple.venn.我没有对设备或图形参数使用特殊的命令或公式.

I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters.

我在R中打印图形,然后作为图元文件"将其复制以生成高质量的图形.

I print my graphs in R and then copied them "as metafile" to produce high quality graphs.

当我将这些图形附加到R中时,它们看起来很好.但是,当我在Word中以PDF格式打印作品时,这些线会显示在图形中.

When i attach these graphs in R they appear just fine. However, when I print my work as PDF in Word these lines appear to graphs.

第一个图形的示例:

venn.plot <- draw.triple.venn(45, 34, 32,
14, 5, 11, 3, c(sprintf("Elevated\nWB Cr and Co"), sprintf("Mixed       or\nsolid PT"), sprintf("Moderate to severe\ng.minimus atrophy")),
lwd = 4,
lty = 'solid',
cex = 3.5,
fontface = "bold",
fontfamily = "sans",
cat.cex = 1.8,
cat.fontface = "bold",
cat.default.pos = "outer",
cat.pos = c(-20, 20, 180),
cat.dist = c(0.115, 0.115, 0.095),
cat.fontfamily = "sans",
rotation = 1
);

第二个示例: boxplot(df $ Crmri〜df $ gmed2,log ="y",yaxt ="n",ylim = c(0.3,200));轴(2,at = c(0,1,2,10,20,100),标签= c("0 ppb","1 ppb","2 ppb","10 ppb","20 ppb","100ppb),las = 2);

我在Word文件中有多个条形图,将这些图另存为PDF后就可以了.

I have several barplots in Word file and after saving as PDF these graphs are just fine.

起初,我尝试将这些图另存为R中的图元文件,然后将它们添加到Word中,但这些行仍然出现.如果我在其他任何查看器中打开我的EMF文件,则这些行不存在.

At first I tried to save those graphs as metafile in R and adding them to Word after but the lines still appear. If I open my EMF-files in any other Viewer those lines are not there.

有什么想法吗?谢谢!

推荐答案

之前在r-help上已经对此进行了讨论.参见:

This has been discussed on r-help before. See:

https://stat.ethz.ch/pipermail/r-help/2011-September/289705.html

似乎是由于使用另存为"然后选择PDF时Word将文档转换为PDF的方式.

Seems to be due to the way Word converts documents to PDFs when you use "Save As" and then choose PDF.

如果您拥有Acrobat(而不仅仅是阅读器),那么通过Adobe PDF打印机"打印文档应该可以摆脱这些限制.否则,您可能需要考虑切换到其他图形格式(例如png).

If you have Acrobat (not just the reader), printing the document via the Adobe PDF "printer" should get rid of the lines. Otherwise, you may have to consider switching to another graphics format (e.g., png).

这篇关于R图中出现奇怪的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆