Ejemplo n.º 1
0
    def init3d(self):
        self.line = mlines.Line2D(
            xdata=(0, 0),
            ydata=(0, 0),
            linewidth=self._axinfo['axisline']['linewidth'],
            color=self._axinfo['axisline']['color'],
            antialiased=True,
        )

        # Store dummy data in Polygon object
        self.pane = mpatches.Polygon(np.array([[0, 0], [0, 1], [1, 0], [0,
                                                                        0]]),
                                     closed=False,
                                     alpha=0.8,
                                     facecolor=(1, 1, 1, 0),
                                     edgecolor=(1, 1, 1, 0))
        self.set_pane_color(self._axinfo['color'])

        self.axes._set_artist_props(self.line)
        self.axes._set_artist_props(self.pane)
        self.gridlines = art3d.Line3DCollection([], )
        self.axes._set_artist_props(self.gridlines)
        self.axes._set_artist_props(self.label)
        self.axes._set_artist_props(self.offsetText)
        # Need to be able to place the label at the correct location
        self.label._transform = self.axes.transData
        self.offsetText._transform = self.axes.transData
Ejemplo n.º 2
0
 def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
     # adir identifies which axes this is
     self.adir = adir
     # data and viewing intervals for this direction
     self.d_interval = d_intervalx
     self.v_interval = v_intervalx
     #
     axis.XAxis.__init__(self, axes, *args, **kwargs)
     self.line = lines.Line2D(
         xdata=(0, 0),
         ydata=(0, 0),
         linewidth=0.75,
         color=(0, 0, 0, 0),
         antialiased=True,
     )
     #
     # these are the panes which surround the boundary of the view
     self.pane_bg_color = (0.95, 0.95, 0.95, 0.1)
     self.pane_fg_color = (0.9, 0.9, 0.9, 0.5)
     self.pane = patches.Polygon([],
                                 alpha=0.2,
                                 facecolor=self.pane_fg_color,
                                 edgecolor=self.pane_fg_color)
     #
     self.axes._set_artist_props(self.line)
     self.axes._set_artist_props(self.pane)
     self.gridlines = art3d.Line3DCollection([])
     self.axes._set_artist_props(self.gridlines)
     self.axes._set_artist_props(self.label)
     self.label._transform = self.axes.transData
Ejemplo n.º 3
0
    def __init__(self, adir, v_intervalx, d_intervalx, axes, *args, **kwargs):
        # adir identifies which axes this is
        self.adir = adir
        # data and viewing intervals for this direction
        self.d_interval = d_intervalx
        self.v_interval = v_intervalx

        maxis.XAxis.__init__(self, axes, *args, **kwargs)
        self.line = mlines.Line2D(xdata=(0, 0), ydata=(0, 0),
                                 linewidth=0.75,
                                 color=(0, 0, 0, 1),
                                 antialiased=True,
                           )

        # Store dummy data in Polygon object
        self.has_pane = True
        self.pane = mpatches.Polygon(np.array([[0,0], [0,1], [1,0], [0,0]]),
                                    alpha=0.8,
                                    facecolor=(1,1,1,0),
                                    edgecolor=(1,1,1,0))

        self.axes._set_artist_props(self.line)
        self.axes._set_artist_props(self.pane)
        self.gridlines = art3d.Line3DCollection([], )
        self.axes._set_artist_props(self.gridlines)
        self.axes._set_artist_props(self.label)
        # Need to be able to place the label at the correct location
        self.label._transform = self.axes.transData
        self.set_rotate_label(kwargs.get('rotate_label', None))
Ejemplo n.º 4
0
    def plot_wireframe(self, X, Y, Z, *args, **kwargs):
        '''
        Plot a 3D wireframe.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *X*, *Y*,   Data values as numpy.arrays
        *Z*
        *rstride*   Array row stride (step size)
        *cstride*   Array column stride (step size)
        ==========  ================================================

        Keyword arguments are passed on to
        :func:`matplotlib.collections.LineCollection.__init__`.

        Returns a :class:`~mpl_toolkits.mplot3d.art3d.Line3DCollection`
        '''

        rstride = kwargs.pop("rstride", 1)
        cstride = kwargs.pop("cstride", 1)

        had_data = self.has_data()
        rows, cols = Z.shape

        tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)

        rii = [i for i in range(0, rows, rstride)]+[rows-1]
        cii = [i for i in range(0, cols, cstride)]+[cols-1]
        xlines = [X[i] for i in rii]
        ylines = [Y[i] for i in rii]
        zlines = [Z[i] for i in rii]

        txlines = [tX[i] for i in cii]
        tylines = [tY[i] for i in cii]
        tzlines = [tZ[i] for i in cii]

        lines = [zip(xl, yl, zl) for xl, yl, zl in \
                zip(xlines, ylines, zlines)]
        lines += [zip(xl, yl, zl) for xl, yl, zl in \
                zip(txlines, tylines, tzlines)]

        linec = art3d.Line3DCollection(lines, *args, **kwargs)
        self.add_collection(linec)
        self.auto_scale_xyz(X, Y, Z, had_data)

        return linec
Ejemplo n.º 5
0
 def add_lines(self, lines, *args, **kwargs):
     linec = art3d.Line3DCollection(lines, *args, **kwargs)
     self.add_collection(linec)
     return linec