if(interactive()){
plot(1:10, type="n")
locs <- locator(n=3, type="o") # click on locations in graph.
# If you do not set n at beginning, press ESC to finish
locs
# In Rstudio, points only appear after finishing.
locatorRS(7, col="blue", type="o") # plots after each click
}
Run the code above in your browser using DataLab