예제 #1
0
    def plot(self):
        try:
            self.ax.cla()
        except AttributeError:
            self.ax = self.add_subplot(1, 1, 1, aspect=self.aspect)

        for a in self.artists:
            a.set_picker(5)
            if isinstance(a, lines.Line2D):
                self.ax.add_line(a)
            elif isinstance(a, patches.Patch):
                self.ax.add_patch(a)
            else:
                self.ax.add_artist(a)

        if self.do_scale_bounds:
            self.view_bbox = util.scale_bounds(self.sys_bbox,
                                               self.oversize_factor)

        self.ax.set_aspect(self.aspect, adjustable='datalim')
        self.update_axis_limits(bbox=self.view_bbox)

        self.draw_frame(self.do_draw_frame)
        self.ax.set_facecolor(self._rgb['background1'])

        self.draw_axes(self.do_draw_axes)

        self.connect_events()
        self.canvas.draw_idle()

        return self
예제 #2
0
    def plot(self):
        try:
            self.ax.cla()
        except AttributeError:
            self.ax = self.add_subplot(1, 1, 1, aspect=self.aspect)

        for a in self.artists:
            a.set_picker(5)
            if isinstance(a, Line2D):
                self.ax.add_line(a)
            elif isinstance(a, Patch):
                self.ax.add_patch(a)
            else:
                self.ax.add_artist(a)

        if self.do_scale_bounds:
            self.view_bbox = scale_bounds(self.sys_bbox, self.oversize_factor)
        self.update_axis_limits()

        self.draw_frame(self.do_draw_frame)
        self.ax.set_facecolor(backgrnd_color)

        self.draw_axes(self.do_draw_axes)

        default_actions = {
            'button_press_event': self.on_press,
            'button_release_event': self.on_release,
            'motion_notify_event': self.on_motion
        }

        self.connect(default_actions)
        self.canvas.draw()

        return self
예제 #3
0
 def scale_bounds(self, oversize_factor):
     bbox = util.scale_bounds(self.sys_bbox, oversize_factor)
     self.ax.set_xlim(bbox[0][0], bbox[1][0])
     self.ax.set_ylim(bbox[0][1], bbox[1][1])