I have a number that the user can click on. Click coordinates will be stored in two vectors x and y. Then I create a new point using plot(x_new, y_new) , and then create this context for me that has the delete point label. When I click on it, I simply delete the corresponding values โโof x and y vectors.
Now I need to somehow remove the plotted point. Currently, I am doing this: when deleting points, I just clear the current cla axes and redraw all the points at once. But for some reason, I believe that this is not the best method, since I also want to display text and some lines of communication between user input points, and it can become quite slow when all things need to be redrawn every time ...
So I'm wondering what is the best way to do this? Would it be nice to just keep the returned descriptors for each point and delete these objects when the point is deleted? The same for communication lines and texts?
Thanks!
source share