R while preserving png / pdf format picture

R how at the same time save png/pdfother image in multiple formats?

If ggplotan object with ggsavea line or two, if not it?

png/pdf()Combination dev.off()is usually stored method, but a combination can only save a picture. To save multiple images to produce images of objects many times as necessary to generate, if a simple mapping script better, copy and paste on the line, if it is a long, complex mapping script it? If the batch cycle is plotted against it?

Non- ggplottarget while drawing generation pngand pdfso on vector graphics, this requirement is common in process development in it, so it is necessary to understand the following methods:

pdf("test.pdf")
a<-dev.cur()   #记录pdf设备
png("test.png")
dev.control("enable")

plot(sin, -pi, 2*pi)  #绘图

dev.copy(which=a)  #复制来自png设备的图片到pdf
dev.off()
dev.off()

Guess you like

Origin www.cnblogs.com/jessepeng/p/11105072.html