import matplotlib.pyplot as plt
from matplotlib.patches import Circle
self.fig, self.ax = plt.subplots()
self.circ = Circle((0.5, 0.5), 0.1)
self.ax.set_title('Click to move the circle')
def on_click(self, event):
if event.inaxes is None:
self.circ.center = event.xdata, event.ydata
@JoeKington So how do I do this for an arc? I don't want to move its centre rather I want to change its starting and ending theta i.e. the spread of the arc.
As a simple (non-draggable) example:
It's a bit annoying that it's inconsistent, but to update the position of a circle, set circ.center = new_x, new_y.
Thank you very much, that did the trick! Since I always advocate the RTFM concept, I'm wondering where I could find this information? I can't see it in patches.Circle, patches.Ellipse, patches.Patch, or artist.Artist.
Unfortunately, it's undocumented. I had to dig through the code to find it (ipython is also a big help). These sort of "corners" of matplotlib definitely need better documentation...