def make_rectangle(self, rect_id, colored='g'): self.rect = Rectangle( (self.image.shape[0] / 2 - self.image.shape[1] / 8, self.image.shape[0] / 2 + self.image.shape[1] / 8), self.image.shape[0] / 4, self.image.shape[1] / 4, color=colored, linewidth=3, fill=False) rect_artist = self.axis.add_artist(self.rect) rect_artist.set_gid(rect_id) self.axis.figure.canvas.draw() return Rectangle.get_gid(self.rect)