ggplot does not work if it is inside a for loop although it works outside of it [duplicate]

When in a for loop, you have to explicitly print your resulting ggplot object :

for (i in 1:5) { 
    print(ggplot(df,aes(x,y))+geom_point()) 
}

Leave a Comment