The problem I'm facing is with the slowness in redrawing a small circle on the plot.
I'm currently doing the equivalent of the interactive class listed in Joe Kington's anwer here -matplotlib: update position of patches (or: set_xy for circles)
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import time
class InteractiveCircle(object):
def __init__(self):
self.fig, self.ax = plt.subplots()
self.ax.axis('equal')
self.circ = Circle((0.5, 0.5), 0.1)
self.ax.add_artist(self.circ)
self.ax.set_title('Click to move the circle')
self.fig.canvas.mpl_connect('button_press_event', self.on_click)
def on_click(self, event):
if event.inaxes is None:
return
self.circ.center = event.xdata, event.ydata
start_time = time.time()
self.fig.canvas.draw()
print "%f" %(time.time() - start_time)
def show(self):
plt.show()
InteractiveCircle().show()
This takes >800ms to redraw a small circle in the graph!!
I tried self.ax.draw_artist(self.circ) from http://matplotlib.1069221.n5.nabble.com/blit-animation-with-patches-td25634.html. This takes <1ms but doesn't redraw the circle :)
I'm very surprised that updating a tiny part of the graph is so slow. I'm looking for a solution that is <1ms.
Any suggestions?
EDIT: Removing reference to tkinter as slowness is reproducible with a matplotlib only example
EDIT: OS - RHEL 5.8
matplotlib --verbose-helpful output
version 1.2.0
platform is linux2
backend TkAgg version 8.6
EDIT: I'm using X-windows over SSH