Rectangle 27 0

python matplotlib: update position of patches (or: set_xy for circles)?

import matplotlib.pyplot as plt
from matplotlib.patches import Circle

class InteractiveCircle(object):
    def __init__(self):
        self.fig, = plt.subplots()'equal')

        self.circ = Circle((0.5, 0.5), 0.1)'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 = event.xdata, event.ydata

    def show(self):


@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 = 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...