I have a plot of waves where I need to identify each peak in the curve:

I would like to do the following:
Reactively add points to the plot where I click to mark the presence of each peak.
ui.R
plotOutput("plot1", click = "plot_click")
server.R
output$plot1 <- renderPlot({
plot(x,y)
points(x=input$plot_click$x,y=input$plot_click$y)
})
The problem here is that although the 'plot_click' mechanism identifies the x and y position of the points- the 'points()' command only causes points to appear momentarily and then disappear.
I also tried reactivePlot but this returned the error:
could not find function "func"