Пример #1
0
    def plot_in_matplotlib(self, **kwargs):
        if 'axes' in kwargs:
            axes = kwargs['axes']
        elif self.dim == 2:
            fig = plt.figure()
            axes = fig.add_subplot(111)
        elif self.dim == 3:
            fig = plt.figure()
            axes = fig.gca(projection='3d')
        else:
            print "I don't know how to display a {d}-D image".format(
                d=self.dim)
            raise RenderingError

        for line in self.lines:
            line.draw_in_matplotlib(axes=axes)
        for point in self.points:
            point.draw_in_matplotlib(axes=axes)
        for pc in self.point_collections:
            pc.draw_in_matplotlib(axes=axes)
        for text in self.text:
            text.draw_in_matplotlib(axes=axes)

        self.xaxis.apply_to_matplotlib(axes=axes)
        self.yaxis.apply_to_matplotlib(axes=axes)
        return axes
Пример #2
0
    def plot_in_matplotlib(self, **kwargs):
        if 'axes' in kwargs:
            axes = kwargs['axes']
        elif self.dim == 2:
            fig = plt.figure()
            axes = fig.add_subplot(111)
        elif self.dim == 3:
            fig = plt.figure()
            axes = fig.gca(projection='3d')
        else:
            print "I don't know how to display a {d}-D image".format(d=self.dim)
            raise RenderingError
                    
        for line in self.lines:
            line.draw_in_matplotlib(axes=axes)
        for point in self.points:
            point.draw_in_matplotlib(axes=axes)
        for pc in self.point_collections:
            pc.draw_in_matplotlib(axes=axes)
        for text in self.text:
            text.draw_in_matplotlib(axes=axes)

        self.xaxis.apply_to_matplotlib(axes=axes)
        self.yaxis.apply_to_matplotlib(axes=axes)
        return axes