Hello Community,
I am here for some suggestions.
I would like to create a loop for creating png images for an entire month. Currently, I am using this code:
library(png)
#for assign coordinates to the png plot
longitude <- lon[,451]
latitude <- lat[468,]
#I have 30 values called monthday (monthday1, 2,3,4..., 30)
#I am replacing the data called "chl" with the monthday values (these are calculated with other #procedure) with this line:
BFG <- replace(chl, c(ocean), monthday1)
#PNG filename and definition
png("figures/April/modis2020/2020-04-01_Modis_2020.jpg",
width=2400, height=1800, res=300 )
##Image data. Body
color <- colorRampPalette(c("purple", "#00007F", "blue", "#007FFF", "cyan","#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000", "black"))
imagep(longitude, latitude, log10(BFG), col=color, zlim=log10(c(0.01, 20)), missingColor=1, xlab="Longitude", ylab="Latitude",zlab='mg m^-3')
box()
title(main = "2020-04-01 Modis 2020",font.main=2,col.main="black", cex.main=1.2)
#Final image closing process
dev.off()
After this part, I got one png (I will attach here), and the same is for all the days.
My request is, how could I reformulate the code for:
- Create the variable BFG with each different day consequently
- Create the consequents days (day 1, 2,3, etc.)
Thanks so much for your time and knowledge.
Christian.