Error When Select And Show Zoom Inside Rectangle Patch
i try to visualize in another panel ( zoom) the area inside rectangle patch all time when the rectangle move witch click mouse i can visualize the area inside rectangle patch the
Solution 1:
You are sending identical x and y values for x1,x2 and y1, y2, so in essence you are zooming to a point and not a rectangle. Remember, you are clicking on a point and calculating the rectangle, so you need to calculate the zoom area from the point. See below:
defon_press(self, click):
x1, y1 = click.xdata, click.ydata
zx1 = x1 - 0.2
zy1 = y1 - 0.2
zx2 = x1 + 0.2
zy2 = y1 + 0.2
self.rect.set_x(x1 - 0.2) #Move the rectangle and centre it on the X click point
self.rect.set_y(y1 - 0.2) #Move the rectangle and centre it on the Y click point
self.axes.plot()
self.canvas.draw()
self.zoom_axes=[zx1,zx2,zy1,zy2]
self.parent.zoom_panel.Update(self)
If you don't want to calculate the rectangle/zoom then investigate matplotlib
's RectangleSelector
Post a Comment for "Error When Select And Show Zoom Inside Rectangle Patch"