There is nothing wrong that I can see. Your code works. Some times such errors arise due to not flowing the ggplot expression properly. Try it like this:
ggplot(train, aes(x= Item_Visibility, y = Item_Outlet_Sales)) + geom_point(size = 2.5, color="navy") + xlab("Item Visibility") + ylab("Item Outlet Sales") + ggtitle("Item Visibility vs Item Outlet Sales")
Assuming you got the data from
https://github.com/hannarud/r-plotting/blob/master/Train_UWu5bXk.csv
1
solved ggplot2 confusion