I am working with some R code that generates a number of images as png files; however, a Rplots.pdf
file keeps on being generated in the working directory, is there a way to prevent this from happening?
library(Cairo)
CairoPNG(file = "graphs.png")
nf <- layout(matrix(c(1:8), 2, 4, byrow=T), c(1, 1), c(1, 1, 1, 1), TRUE)
for (k in 1:num.k) {
plotMatrix(connect.matrix.ordered[k,,], log = F, main = paste("k=", k.vector[k]), sub = paste("Cophenetic coef.=", rho[k]), ylab = "samples", xlab ="samples")
}
y.range <- c(1 - 2*(1 - min(rho)), 1)
plot(k.vector, rho, main ="Cophenetic Coefficient", xlim=c(k.init, k.final), ylim=y.range, xlab = "k", ylab="Cophenetic correlation", type = "n")
lines(k.vector, rho, type = "l", col = "black")
points(k.vector, rho, pch=22, type = "p", cex = 1.25, bg = "black", col = "black")
dev.off()
Rplots.png
?? I can't see how @Andrie's answer would stop a PDF device being created, but can see it being a solution if you actually meanRplots.png
??? – HomagerRplot001.png
file that is being generated and not cleaned. – Sporadeslibrary(Cairo); CairoPNG(file = "graphs.png"); layout(matrix(c(1:4), 2)); for (k in 1:4) plot(1,k); dev.off()
– Habitue