1

I have a plot with a lot of points and on mouse click I want to add shapes (circle and lines) to the plot. Right now I'm trying to do this with patches, but after adding a patch to my axis it doesn't show immediately, only when I zoom or drag the plot a little bit.

I tried refreshing with Figure.draw_idle() but this redraws the entire plot and takes over a second when I would like the patches to appear instantly. Is there a way to just update the patch?

  • 1
    Can you please provide a minimal, reproducible example please ? – thmslmr Mar 27 '23 at 11:48
  • You might want to look into [mplcursors](https://mplcursors.readthedocs.io/). Some examples: [Scope in subplot similar to MATLAB's stackedplot()](https://stackoverflow.com/questions/63358465) and [show and highlight coordinates of nearby local extreme](https://stackoverflow.com/questions/60357209). Lines can be used to simulate a crosshair cursor. Similarly, you could use a large open scatter dot to encircle something. – JohanC Mar 27 '23 at 13:29
  • I kinda found a solution: the easiest way to quickly draw something on top of the plot is to use blitting. I was able to speed up drawing quite a bit. For zooming and panning a redraw is still required though – snakeslayer09 Apr 27 '23 at 11:53

0 Answers0