Closed boram1024 closed 10 months ago
I want multiple plot using for loop in R my code is below...but it's not working following the massage
Error in png(filename = mypath) : png() In addition: Warning messages: 1: In png(filename = mypath) : 2: In png(filename = mypath) : opening device failed
what is the problem?
for(i in 0:9) { start <- 1+i*10 end <- (1+i)*10 plot_title <- df$time[[start]] mypath <- file.path("C:/Users/DS266/Desktop/calibration", paste("myplot_", plot_title, ".png", sep = "")) par(mar=c(5,5,5,5)) plot(df$time[start:end], df$flow_3[start:end]) # type = 'b', # pch = 6, # cex = 0.5, # col = 6, # xlab = "", # ylab = "", # ylim = c(0,6), # axes = T, # ann = F) png(file = mypath) dev.off() }
Pretty sure you want to call png() before plot()?
png()
plot()
Closing since it doesn't seem like this is a thematic specific issue
I want multiple plot using for loop in R my code is below...but it's not working following the massage
Error in png(filename = mypath) : png() In addition: Warning messages: 1: In png(filename = mypath) : 2: In png(filename = mypath) : opening device failed
what is the problem?