-9

Hi can anyone tell me whats wrong with following R code?

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")
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294

1 Answers1

0

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

enter image description here

gatsky
  • 1,180
  • 7
  • 8
  • No problems. In future, please heed the advice about posting good questions in the other comments above. Also, pasting the error message from R into a search engine often gives you the answer right away! Have a read of this as well: https://www.r-project.org/help.html – gatsky Jul 02 '17 at 06:35