Пример #1
0
 def plot(self, *args, **kwargs):
     from art3d_gl import line_3d_to_gl
     fc = kwargs.pop('facecolor', None)
     gl_offset = kwargs.pop('gl_offset', (0, 0, 0))
     array_idx = kwargs.pop('array_idx', None)
     lines = Axes3D.plot(self, *args, **kwargs)
     for l in lines:
         line_3d_to_gl(l)
         l._facecolor = fc
         l._gl_offset = gl_offset
         l._gl_array_idx = array_idx
     return lines
Пример #2
0
 def plot(self, *args, **kwargs):
     from art3d_gl import line_3d_to_gl
     fc = kwargs.pop('facecolor', None)
     gl_offset = kwargs.pop('gl_offset', (0,0,0))
     array_idx = kwargs.pop('array_idx', None)
     lines = Axes3D.plot(self, *args, **kwargs)
     for l in lines:
         line_3d_to_gl(l)
         l._facecolor = fc
         l._gl_offset = gl_offset
         l._gl_array_idx = array_idx
     return lines
Пример #3
0
    def plot(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.plot` for arrays,
        or it can be used to plot :class:`mantid.api.MatrixWorkspace`
        or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::

            import matplotlib.pyplot as plt
            from mantid import plots

            ...

            fig, ax = plt.subplots(subplot_kw={'projection':'mantid3d'})
            ax.plot(workspace) #for workspaces
            ax.plot(x,y,z)     #for arrays
            fig.show()

        For keywords related to workspaces, see :func:`mantid.plots.plotfunctions3D.plot3D`
        '''
        if mantid.plots.helperfunctions.validate_args(*args):
            mantid.kernel.logger.debug('using mantid.plots.plotfunctions3D')
            return mantid.plots.plotfunctions3D.plot(self, *args, **kwargs)
        else:
            return Axes3D.plot(self, *args, **kwargs)
Пример #4
0
    def plot(self, *args, **kwargs):
        '''
        If the **mantid3d** projection is chosen, it can be
        used the same as :py:meth:`matplotlib.axes.Axes3D.plot` for arrays,
        or it can be used to plot :class:`mantid.api.MatrixWorkspace`
        or :class:`mantid.api.IMDHistoWorkspace`. You can have something like::

            import matplotlib.pyplot as plt
            from mantid import plots

            ...

            fig, ax = plt.subplots(subplot_kw={'projection':'mantid3d'})
            ax.plot(workspace) #for workspaces
            ax.plot(x,y,z)     #for arrays
            fig.show()

        For keywords related to workspaces, see :func:`mantid.plots.plotfunctions3D.plot3D`
        '''
        if mantid.plots.helperfunctions.validate_args(*args):
            mantid.kernel.logger.debug('using mantid.plots.plotfunctions3D')
            return mantid.plots.plotfunctions3D.plot(self, *args, **kwargs)
        else:
            return Axes3D.plot(self, *args, **kwargs)
Пример #5
0
    def __init__(self, quads: list, ax: axes3d.Axes3D):
        self.quads = list()
        self.quadGui = list()
        self.ax = ax

        # type checking
        for quad_temp in quads:
            if isinstance(quad_temp, Qfm.QuadModel):
                self.quads.append(quad_temp)
            else:
                raise Cf.QuadrotorFlyError("Not a QuadrotorModel type")

        index = 1
        for quad_temp in self.quads:
            label = ax.text([], [], [], str(index), fontsize='large')
            index += 1
            if quad_temp.uavPara.structureType == Qfm.StructureType.quad_plus:
                hub, = ax.plot([], [], [],
                               marker='o',
                               color='green',
                               markersize=6,
                               antialiased=False)
                bar_x, = ax.plot([], [], [],
                                 color='red',
                                 linewidth=3,
                                 antialiased=False)
                bar_y, = ax.plot([], [], [],
                                 color='black',
                                 linewidth=3,
                                 antialiased=False)
                self.quadGui.append({
                    'hub': hub,
                    'barX': bar_x,
                    'barY': bar_y,
                    'label': label
                })
            elif quad_temp.uavPara.structureType == Qfm.StructureType.quad_x:
                hub, = self.ax.plot([], [], [],
                                    marker='o',
                                    color='green',
                                    markersize=6,
                                    antialiased=False)
                front_bar1, = self.ax.plot([], [], [],
                                           color='red',
                                           linewidth=3,
                                           antialiased=False)
                front_bar2, = self.ax.plot([], [], [],
                                           color='red',
                                           linewidth=3,
                                           antialiased=False)
                back_bar1, = self.ax.plot([], [], [],
                                          color='black',
                                          linewidth=3,
                                          antialiased=False)
                back_bar2, = self.ax.plot([], [], [],
                                          color='black',
                                          linewidth=3,
                                          antialiased=False)
                self.quadGui.append({
                    'hub': hub,
                    'bar_frontLeft': front_bar1,
                    'bar_frontRight': front_bar2,
                    'bar_rearLeft': back_bar1,
                    'bar_rearRight': back_bar2,
                    'label': label
                })