压缩R中pdf plot的文件大小

时间:2016-08-20 12:08:52

标签: r data-visualization

我在R中保存了几个文件大小的pdf图,问题是我需要将它们导入Latex,这需要花费很多时间。我想知道如何在R中保存文件较小的图?感谢。

示例1.

 seasonplot(ts(hdemand$Demand,frequency=24),   
           col=rainbow(length(hdemand$Demand)/48))
dev.print(device=pdf,file="hourdemand.pdf")
dev.off()

enter image description here

示例2.(由于数据的大小,即使拟合的绘图也需要时间)

par(mfrow=c(1,2))
plot(data$Temp,all.data$Demand)
abline(lm(data$Demand~data$Temp), col="red") 

plot(data$APX,data$Demand)
abline(lm(data$Demand~data$APX), col="red") 
dev.print("LR.pdf",device=pdf)
dev.off()

enter image description here

1 个答案:

答案 0 :(得分:0)

减少您正在绘制的点数。

但是如果你不能这样做,并且不关心它在放大时的外观,那么在方便的dpi中写出png,然后在R外转换为pdf。