For ggplot to work inside a for loop you have to explicitly call the print() function. i.e.,
for (i in 1:5) {
print(ggplot(df,aes(x,y))+geom_point())
}
This happens because the print() method is called automatically by R, every time a variable is queried and, for a ggplot object, it draws the content of your object on your device. An interesting side-effect of this is that ggplots are only rendered when explicitly print()ed/plot()ed within a loop, as only the last return value in a sequence of calls gets its print method invoked.