wants <- c("Cairo")
has <- wants %in% rownames(installed.packages())
if(any(!has)) install.packages(wants[!has])
The downloaded source packages are in
'/tmp/RtmpUpcoMQ/downloaded_packages'
dev.new(); dev.new(); dev.new()
dev.list()png pdf pdf pdf
2 3 4 5
dev.cur()pdf
5
dev.set(3)pdf
3
dev.set(dev.next())pdf
4
dev.off()pdf
5
graphics.off()pdf(), png() and jpeg() are functions that open a graphics file of the corresponding type. See ?device for more.
pdf("pdf_test.pdf", width=5, height=5)
plot(1:10, rnorm(10))
dev.off()plot(1:10, rnorm(10))
dev.copy(jpeg, filename="copied.jpg", quality=90)
graphics.off()CairoCairo() has a dpi option for choosing the graphics resolution in the output file. Option type chooses the type of the graphics file.
library(Cairo)
Cairo(width=5, height=5, units="in", file="Cairo_pdf.pdf", type="pdf",
bg="white", canvas="white", dpi=120)
plot(1:10, rnorm(10))
dev.off()try(detach(package:Cairo))R markdown - markdown - R code - all posts