I use this loop to plot 96 different columns in a dataset, to visualise them in the same figure.
This plot was supposed to help with that, and it does create 96 different plots called "plot_1", "plot_2", "plot_3" etc.
However, all the plots are just a copy of the last column, and i simply cant seem to figure out why, i must be missing something..
Code is below:
for (i in 3:ncol(od)){
print(i)
p1<-ggplot(od, aes(x=time,y=od[,i]))+
geom_point(color="tomato")+
ggtitle(colnames(od)[i])+
theme(plot.title=element_text(margin=margin(t=40,b=-40)),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.title.y=element_blank(),
axis.title.x=element_blank())
assign(paste("plot_",i,sep=""), p1,envir = .GlobalEnv)
}
Thanks so much in advance!