def drawTrack(self, index):
     #get necessary target data
     tid = int(self.targets[0, index])
     x = self.targets[1, index]
     y = self.targets[2, index]
     z = self.targets[3, index]
     xr = self.targets[11, index]
     yr = self.targets[10, index]
     zr = self.targets[12, index]
     edge_color = pg.glColor(self.colorArray[tid % 3])
     track = self.ellipsoids[tid]
     #if classifier is on, set non human targets to white
     if (len(self.classifierOut) != 0):
         try:
             dTID = self.classifierOut[0].tolist()
             posit = dTID.index(tid)
             decision = self.classifierOut[1, posit]
         except Exception as ex:
             print('Cannot find tid ', tid, ' in list:')
             print(dTID)
             print(ex)
         if (decision != 1):
             edge_color = pg.glColor('w')
     mesh = getBoxLinesCoords(x, y, z)
     track.setData(pos=mesh,
                   color=edge_color,
                   width=2,
                   antialias=True,
                   mode='lines')
     track.setVisible(True)
 def drawBoundaryBox3d(self, index):
     #print(index)
     bList = self.boundaryBoxes[index]['boundList']
     xl = float(bList[0].text())
     xr = float(bList[1].text())
     yl = float(bList[2].text())
     yr = float(bList[3].text())
     zl = float(bList[4].text())
     zr = float(bList[5].text())
     #print(xl,yl,zl,xr,yr,zr)
     self.bbox = [xl, xr, yl, yr, zl, zr]
     boxLines = getBoxLines(xl, yl, zl, xr, yr, zr)
     squareLine = getSquareLines(xl, yl, xr, yr, zl)
     if (self.boundaryBoxViz[index].visible() == False):
         print("Setting Box ", str(index), " to visible")
         self.boundaryBoxViz[index].setVisible(True)
         self.bottomSquare[index].setVisible(True)
     self.boundaryBoxViz[index].setData(pos=boxLines,
                                        color=pg.glColor('r'),
                                        width=2,
                                        antialias=True,
                                        mode='lines')
     self.bottomSquare[index].setData(pos=squareLine,
                                      color=pg.glColor('b'),
                                      width=2,
                                      antialias=True,
                                      mode='line_strip')
     print('Drew both boxes')
Example #3
0
    def draw_axes(self):
        """
        Desc: Draw the grid axes

        Input(s):
            none
        Output(s):
            none
        """
        # add all three colored axes
        xaxis_pts = np.array([
            [0.0, 0.0, 0.0],  # north axis start and end point
            [1.1 * self.gridworld.world_size[0], 0.0, 0.0]
        ])
        xaxis = gl.GLLinePlotItem(pos=xaxis_pts,
                                  color=pg.glColor('r'),
                                  width=3.0)  # create line plot item
        self.w.addItem(xaxis)  # add item to graph
        yaxis_pts = np.array([
            [0.0, 0.0, 0.0],  # east axis start and end point
            [0.0, 1.1 * self.gridworld.world_size[1], 0.0]
        ])
        yaxis = gl.GLLinePlotItem(pos=yaxis_pts,
                                  color=pg.glColor('g'),
                                  width=3.0)  # create line plot item
        self.w.addItem(yaxis)  # add item to graph
        zaxis_pts = np.array([
            [0.0, 0.0, 0.0],  # down axis start and end point
            [0.0, 0.0, 5.0 * self.gridworld.world_delta]
        ])
        zaxis = gl.GLLinePlotItem(pos=zaxis_pts,
                                  color=pg.glColor('b'),
                                  width=3.0)  # create line plot item
        self.w.addItem(zaxis)
Example #4
0
    def __init__(self):
        self._plot_color = {
            'b': pg.glColor(0, 0, 255),
            'g': pg.glColor(0, 255, 0),
            'r': pg.glColor(255, 0, 0),
            'y': pg.glColor(255, 255, 0),
            'gr': pg.glColor(255 * 3 / 4, 255 * 3 / 4, 255 * 3 / 4)
        }

        self.app = QtGui.QApplication([])
        self.window = self.__initWindow()
        self.__setupEnvironment(self.window)

        win = pg.GraphicsWindow(title="Basic plotting examples")
        win.setWindowTitle('pyqtgraph example: Plotting')
        self.win = win
        # Enable antialiasing for prettier plots
        pg.setConfigOptions(antialias=True)

        self.plots = []

        ##        self.add_subplot(2,2,1)
        ##        self.plot([4,5,6])
        ##        self.add_subplot(2,2,4)
        ##        self.plot([6,5,4])
        #self.plot(2,2,0)
        return
 def __init__(self):
     self.app=QtGui.QApplication(sys.argv)
     self.window = opengl.GLViewWidget()
     self.window.setGeometry(0,410,800,800)
     self.window.setCameraPosition(distance=12,azimuth=270)
     x_axis=opengl.GLGridItem()
     x_axis.setSize(x=10,y=10)
     #y_axis=opengl.GLGridItem()
     #y_axis.rotate(90,0,1,0)
     #self.window.addItem(y_axis)
     self.grid=Cell()
     self.q=Qlearning(no_of_actions,no_of_states,state_combinations)
     self.window.addItem(x_axis)
     self.current_node=self.grid.grid_nodes[0]
     self.nodes=opengl.GLScatterPlotItem(pos=self.grid.grid_nodes,color=glColor((0,255,0)),size=7)
     self.goal=opengl.GLScatterPlotItem(pos=self.grid.goal_node,color=glColor((0,0,255)),size=15)
     self.current_node_item=opengl.GLScatterPlotItem(pos=self.current_node,color=glColor((255,0,0)),size=9)
     self.blocked=opengl.GLScatterPlotItem(pos=self.grid.blocked_nodes,color=glColor((255,255,255)),size=13)
     self.counter=0
     self.generation_counter=0
     self.step_counter=0
     self.tracker=[]
     self.window.addItem(self.nodes)
     self.window.addItem(self.blocked)
     self.window.addItem(self.current_node_item)
     self.window.addItem(self.goal)
     self.window.show()
 def drawBoundaryBox3d(self, index):
     #print(index)
     bList = self.boundaryBoxes[index]['boundList']
     xl = float(bList[0].text())
     xr = float(bList[1].text())
     yl = float(bList[2].text())
     yr = float(bList[3].text())
     if (self.orientationSelection.currentText() == 'Side Mount'):
         zl = float(bList[4].text())
         zr = float(bList[5].text())
     elif (self.orientationSelection.currentText() == 'Overhead Mount'):
         zl = float(bList[4].text()) - self.profile['sensorHeight']
         zr = float(bList[5].text()) - self.profile['sensorHeight']
     #print(xl,yl,zl,xr,yr,zr)
     self.bbox = [xl, xr, yl, yr, zl, zr]
     boxLines = getBoxLines(xl, yl, zl, xr, yr, zr)
     squareLine = getSquareLines(xl, yl, xr, yr, zl)
     if (self.boundaryBoxViz[index].visible() == False):
         print("Setting Box ", str(index), " to visible")
         self.boundaryBoxViz[index].setVisible(True)
         self.bottomSquare[index].setVisible(True)
     self.boundaryBoxViz[index].setData(pos=boxLines,
                                        color=pg.glColor('r'),
                                        width=2,
                                        antialias=True,
                                        mode='lines')
     self.bottomSquare[index].setData(pos=squareLine,
                                      color=pg.glColor('b'),
                                      width=2,
                                      antialias=True,
                                      mode='line_strip')
     print('Drew both boxes')
Example #7
0
    def __init__(self, N, clusters):
        self.clusters = clusters

        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 100
        self.w.setWindowTitle('RGB space')
        self.w.setGeometry(100, 100, 500, 500)
        self.w.show()
        # create the background grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(0, 10, 10)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(10, 0, 10)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(10, 10, 0)
        self.w.addItem(gz)

        self.curve1 = gl.GLLinePlotItem()
        self.curve2 = gl.GLLinePlotItem()
        self.curve3 = gl.GLLinePlotItem()
        self.w.addItem(self.curve1)
        self.w.addItem(self.curve2)
        self.w.addItem(self.curve3)
        self.pca = decomposition.PCA(n_components=3)

        self.centers = [None for _ in range(clusters)]
        for i in range(clusters):
            pts = np.array([0, 0, 0]) / 14
            self.centers[i] = gl.GLScatterPlotItem(pos=pts,
                                                   color=pg.glColor(
                                                       0, 0, 255, 255))
            self.w.addItem(self.centers[i])

        self.cyl = []
        for i in range(clusters):
            CYL = gl.MeshData.cylinder(rows=10,
                                       cols=20,
                                       radius=[1., 1.0],
                                       length=5.)
            self.cyl.append(
                gl.GLMeshItem(meshdata=CYL,
                              smooth=True,
                              drawEdges=True,
                              edgeColor=(1, 0, 0, 0.1),
                              shader='balloon'))
            self.cyl[-1].setGLOptions('additive')
            self.w.addItem(self.cyl[-1])

        self.traces = dict()
        for i in range(N):
            pts = np.array([0, 0, 0]) / 14
            self.traces[i] = gl.GLScatterPlotItem(pos=pts,
                                                  color=pg.glColor(
                                                      100, 100, 100, 100))
            self.w.addItem(self.traces[i])
    def __init__(self):
        """
        Initialize the graphics window and mesh surface
        """

        # setup the view window
        self.app = QtGui.QApplication(sys.argv)
        self.window = gl.GLViewWidget()
        self.window.setWindowTitle('Terrain')
        self.window.setGeometry(0, 110, 1920, 1080)
        self.window.setCameraPosition(distance=30, elevation=12)
        self.window.show()

        gx = gl.GLGridItem()
        gy = gl.GLGridItem()
        gz = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gy.rotate(90, 1, 0, 0)
        gx.translate(-10, 0, 0)
        gy.translate(0, -10, 0)
        gz.translate(0, 0, -10)
        self.window.addItem(gx)
        self.window.addItem(gy)
        self.window.addItem(gz)

        modeln = 'mobilenet_thin'
        modelr = '432x368'
        camera = 0

        self.lines = {}
        self.connection = [
            [0, 1], [1, 2], [2, 3], [0, 4], [4, 5], [5, 6],
            [0, 7], [7, 8], [8, 9], [9, 10], [8, 11], [11, 12],
            [12, 13], [8, 14], [14, 15], [15, 16]
        ]

        w, h = model_wh(modelr)
        self.e = TfPoseEstimator(get_graph_path(modeln), target_size=(w, h))
        self.cam = cv2.VideoCapture(camera)
        ret_val, image = self.cam.read()
        self.poseLifting = Prob3dPose('./skeleton_humanactivity/lifting/models/prob_model_params.mat')
        keypoints = self.mesh(image)

        self.points = gl.GLScatterPlotItem(
            pos=keypoints,
            color=pg.glColor((0, 255, 0)),
            size=15
        )
        self.window.addItem(self.points)

        for n, pts in enumerate(self.connection):
            self.lines[n] = gl.GLLinePlotItem(
                pos=np.array([keypoints[p] for p in pts]),
                color=pg.glColor((0, 0, 255)),
                width=3,
                antialias=True
            )
            self.window.addItem(self.lines[n])
Example #9
0
 def onShowPartitionsButtonClicked(self):
     colorPools = [pg.glColor('r'), pg.glColor('g'), pg.glColor('b'), pg.glColor('y'), pg.glColor('c')]
     colorPools = [[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1], [1, 1, 0, 1], [1, 0, 1, 1], [0, 1, 1, 1]]
     ii = 0
     for chosenPartitionName in self.plotwidget.partitionInfo.keys():
         visitedVoxels = self.plotwidget.partitionInfo[chosenPartitionName]['visitedVoxels']
         color = colorPools[ii]
         self.plotwidget.showVoxelsVisited(visitedVoxels, color=color)
         ii += 1
Example #10
0
    def drawMAV(self, state):
        """
        Update the drawing of the MAV.

        The input to this function is a (message) class with properties that define the state.
        The following properties are assumed:
            state.pn  # north position
            state.pe  # east position
            state.h   # altitude
            state.phi  # roll angle
            state.theta  # pitch angle
            state.psi  # yaw angle
        """
        mav_position = np.array([[state.pn], [state.pe],
                                 [-state.h]])  # NED coordinates
        # attitude of mav as a rotation matrix R from body to inertial
        R = RotationBody2Vehicle(state.phi, state.theta, state.psi)
        # rotate and translate points defining mav
        rotated_points = self.rotate_points(self.mav_points, R)
        translated_points = self.translate_points(rotated_points, mav_position)
        # convert North-East Down to East-North-Up for rendering
        R = np.array([[0, 1, 0], [1, 0, 0], [0, 0, -1]])

        translated_points = np.matmul(R, translated_points)
        # convert points to triangular mesh defined as array of three 3D points (Nx3x3)
        mesh = self.points_to_mesh(translated_points)
        if not self.plot_initialized:
            # initialize drawing of triangular mesh.
            self.mav_body = gl.GLMeshItem(
                vertexes=mesh,  # defines the triangular mesh (Nx3x3)
                vertexColors=self.mav_meshColors,  # defines mesh colors (Nx1)
                drawEdges=False,  # draw edges between mesh elements
                smooth=False,  # speeds up rendering
                computeNormals=False)  # speeds up rendering
            self.window.addItem(self.mav_body)  # add body to plot
            axis_length = 220.0
            naxis_pts = np.array([[0.0, 0.0, 0.0], [0.0, axis_length, 0.0]])
            naxis = gl.GLLinePlotItem(pos=naxis_pts,
                                      color=pg.glColor('r'),
                                      width=3.0)
            self.window.addItem(naxis)
            eaxis_pts = np.array([[0.0, 0.0, 0.0], [axis_length, 0.0, 0.0]])
            eaxis = gl.GLLinePlotItem(pos=eaxis_pts,
                                      color=pg.glColor('g'),
                                      width=3.0)
            self.window.addItem(eaxis)
            daxis_pts = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, -axis_length]])
            daxis = gl.GLLinePlotItem(pos=daxis_pts,
                                      color=pg.glColor('b'),
                                      width=3.0)
            self.window.addItem(daxis)
        else:
            # draw MAV by resetting mesh using rotated and translated points
            self.mav_body.setMeshData(vertexes=mesh,
                                      vertexColors=self.mav_meshColors)
Example #11
0
    def updatePlot(self):
        if self.leapTrue:
            self.leapMotionSendCommand()
        for i in range(len(self.joints) + 1):
            if i < len(self.joints):
                self.plotCurves[i][0].setData(
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    self.dataBuffer['pd' + str(i)][:self.dataBufferPtr])
                self.plotCurves[i][1].setData(
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    self.dataBuffer['p' + str(i)][:self.dataBufferPtr])
                ptsPd = np.vstack([
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    np.ones(self.dataBufferPtr) * i * self.curveSpacing,
                    self.dataBuffer['pd' + str(i)][:self.dataBufferPtr] / 20.0
                ]).transpose()
                ptsP = np.vstack([
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    np.ones(self.dataBufferPtr) * i * self.curveSpacing,
                    self.dataBuffer['p' + str(i)][:self.dataBufferPtr] / 20.0
                ]).transpose()
                self.plotCurve3D[i][0].setData(pos=ptsPd,
                                               color=pg.glColor('r'),
                                               width=2,
                                               antialias=True)
                self.plotCurve3D[i][1].setData(pos=ptsP,
                                               color=pg.glColor('b'),
                                               width=2,
                                               antialias=True)

            else:
                self.plotCurves[i][0].setData(
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    self.dataBuffer[
                        'pd' + str(self.viewLinkNum)][:self.dataBufferPtr])
                self.plotCurves[i][1].setData(
                    self.dataBuffer['time'][:self.dataBufferPtr],
                    self.dataBuffer[
                        'p' + str(self.viewLinkNum)][:self.dataBufferPtr])

            boxState = self.plotViews[i].getViewBox().getState(copy=False)
            curTime = self.dataBuffer['time'][self.dataBufferPtr - 1]
            if boxState['autoRange'][0] == True:
                self.boxRolling[i] = 1
            if self.boxRolling[i] == 1:
                #                curTime=self.dataBuffer['time'][self.dataBufferPtr-1]
                if curTime > 10:
                    xRange = [curTime - 10, curTime]
                    self.plotViews[i].setRange(xRange=xRange)
            if i != 1 and i != 2:
                self.plotViews[i].setRange(yRange=[0, 200])

            curpos = self.plotView3D.opts['center']
            self.plotView3D.pan(curTime - curpos[0], 0, 0)
    def __init__(self, game_tick_packet):
        self.traces = dict()

        self.app = pg.Qt.QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 40
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(0, 50, 1920, 1080)
        self.w.show()
        # Open anonymous shared memory for entire GameInputPacket

        # Map buffer to ctypes structure
        self.game_tick_packet = game_tick_packet

        # create the background grids
        gx = gl.GLGridItem()
        gx.setSize(12000, 12000, 10000)
        gx.rotate(90, 0, 1, 0)
        gx.translate(-6000, 0, 0)
        gx.setSpacing(100, 100, 100)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -6000, 0)
        gy.setSize(12000, 12000, 10000)
        gy.setSpacing(100, 100, 100)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.setSize(12000, 12000, 10000)
        gz.setSpacing(100, 100, 100)
        self.w.addItem(gz)


        # Adding rlbot cars
        bluecar_x = self.game_tick_packet.gamecars[0].Location.X
        bluecar_y = self.game_tick_packet.gamecars[0].Location.Y
        bluecar_z = self.game_tick_packet.gamecars[0].Location.Z
        bluecar_x_plot = np.array([bluecar_x, bluecar_x + CAR_WIDTH])
        bluecar_y_plot = np.array([bluecar_y, bluecar_y + CAR_WIDTH])
        bluecar_z_plot = np.array([bluecar_z, bluecar_z + CAR_WIDTH])
        bluepts = np.vstack([bluecar_x_plot, bluecar_y_plot, bluecar_z_plot]).transpose()
        someitem = gl.GLScatterPlotItem(pos=bluepts, color=pg.glColor('b'), width=CAR_WIDTH, antialias=True)
        self.bluecar = gl.GLLinePlotItem(pos=bluepts, color=pg.glColor('b'), width=CAR_WIDTH, antialias=True)
        self.w.addItem(self.bluecar)

        orngcar_x = self.game_tick_packet.gamecars[1].Location.X
        orngcar_y = self.game_tick_packet.gamecars[1].Location.Y
        orngcar_z = self.game_tick_packet.gamecars[1].Location.Z
        orngcar_x_plot = np.array([orngcar_y, orngcar_y + CAR_WIDTH])
        orngcar_y_plot = np.array([orngcar_z, orngcar_z + CAR_WIDTH])
        orngcar_z_plot = np.array([-1.0 * orngcar_x, -1.0 * orngcar_x + CAR_WIDTH])
        orngpts = np.vstack([orngcar_x_plot, orngcar_y_plot, orngcar_z_plot]).transpose()
        self.orngcar = gl.GLLinePlotItem(pos=orngpts, color=pg.glColor('r'), width=CAR_WIDTH, antialias=True)
        self.w.addItem(self.orngcar)
Example #13
0
    def update_cylinders(self, cyl_info):
        # v1,v2,v3, R, L,c1,c2,c3, p
        #  0, 1, 2, 3, 4, 5, 6, 7, 8
        for i in range(self.clusters):
            vec = cyl_info[i, :3]
            vec = vec / (np.sum(np.power(vec, 2))**0.5)
            r = (cyl_info[i, 3]**0.5) / 14
            l = (cyl_info[i, 4]**0.5) / 14

            self.cyl[i].resetTransform()
            CYL = gl.MeshData.cylinder(rows=10,
                                       cols=20,
                                       radius=[r, r],
                                       length=2 * l)
            self.cyl[i].setMeshData(meshdata=CYL)
            self.cyl[i].setColor(
                pg.glColor(255, 255, 255, cyl_info[i, 8] * 100))

            a = np.rad2deg(np.arccos(vec[2] / (np.sum(vec**2)**0.5)))
            self.cyl[i].rotate(a, -vec[0], vec[1], 0)
            c = [
                cyl_info[i, 5] / 14 - vec[0] * l,
                cyl_info[i, 6] / 14 - vec[1] * l,
                cyl_info[i, 7] / 14 - vec[2] * l
            ]
            self.cyl[i].translate(c[0], c[1], c[2])

            for i in range(self.clusters):
                self.centers[i].setData(pos=cyl_info[i, 5:8] / 14)
        pg.QtGui.QApplication.processEvents()
    def __init__(self):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 100                                # Distance to view from
        self.w.setWindowTitle('pyqtgraph : OPENGL Line Plot')        # Title
        self.w.setGeometry(0, 110, 1920, 1080)                       # Viewing box geometery
        self.w.show()

        self.phase = 0                                               # Phase offset initial  Value 
        self.lines = 50                                              # Number of lines
        self.points = 1000                                           # Number of points to be displayed
        self.y = np.linspace(-10, 10, self.lines) 
        self.x = np.linspace(-10, 10, self.points)

        for i, line in enumerate(self.y):
            y = np.array([line] * self.points)
            d = np.sqrt(self.x ** 2 + y ** 2)
            sine = 10 * np.sin(d + self.phase)
            pts = np.vstack([self.x, y, sine]).transpose()
            self.traces[i] = gl.GLLinePlotItem(
                pos=pts,
                color=pg.glColor((i, self.lines * 1.3)),
                width=(i + 1) / 10,
                antialias=True
            )
            self.w.addItem(self.traces[i])
Example #15
0
 def gen_path(self):
     if self.mesh_info.mesh == None:
         return
     self.view_slice.items = [] 
     self.update_var()
     self.mesh_info.first_layer_thicknes = self.conf.get("first_layer_thickness")
     self.mesh_info.layer_thickness = self.conf.get("layer_thickness")        
     #self.mesh_info.init(self.mesh_info.pixel_size, self.mesh_info.first_layer_thickness, self.mesh_info.layer_thickness)
     self.message(self.mesh_info.get_info())
     curdir = os.getcwd()        
     if(path.isdir("images")):
         #remove all files in images
         filelist = [ f for f in os.listdir("./images") if f.endswith(".png") ]            
         for f in filelist:
             os.remove(os.path.join(curdir+"/images", f))  
     else:
         os.mkdir("images")
     self.out_path = os.path.join(curdir, "images")        
     #self.path_verts = mkspiral.gen_continuous_path(self.mesh_info, self.out_path, 2000, self.conf.get("infill_offset"))
     self.path_verts = mkspiral.gen_continuous_path_with_constraint(self.mesh_info, self.out_path, 2000, 60,self.conf.get("infill_offset"))  
     plt = gl.GLLinePlotItem(pos=self.path_verts, color=pg.glColor('r'), width= 1, antialias=True)
     
     self.view_slice.addItem(plt)      
     self.view_slice.setBackgroundColor(pg.mkColor('w'))
     return
Example #16
0
 def updatePlot(self, iSlice, vname):
     logger.debug('GlPlot::updatePlot()')
     #print('updatePlot() ', self.win)
     if self.plotType == 'render':
         e = np.zeros((128, 128))
         self.glWin[vname].setData(z=e)
         self.glWin[vname].setData(z=iSlice)
     elif self.plotType == 'mesh':
         n = self.xydim
         #fSlice = np.float32(iSlice)
         y = np.linspace(0, self.xydim, self.xydim)
         x = np.linspace(0, self.xydim, self.xydim)
         for i in range(self.xydim):
             yi = np.array([y[i]] * self.xydim)
             z = np.float32(iSlice[:, i])
             pts = np.vstack([x, yi, z]).transpose()
             self.glWin = gl.GLLinePlotItem(pos=pts,
                                            color=pg.glColor((i, n * 1.3)),
                                            width=1.0,
                                            antialias=True)
             #self.glWin.setData(pos=pts)
             self.win.addItem(self.glWin[vname])
     else:
         logger.info('Unknown plot type')
         return
 def __init__(self, N):
     self.w = gl.GLViewWidget()
     self.w.opts['distance'] = 100
     self.w.setWindowTitle('RGB space')
     self.w.setGeometry(100, 100, 500, 500)
     self.w.show()
     # create the background grids
     gx = gl.GLGridItem()
     gx.rotate(90, 0, 1, 0)
     gx.translate(0, 10, 10)
     self.w.addItem(gx)
     gy = gl.GLGridItem()
     gy.rotate(90, 1, 0, 0)
     gy.translate(10, 0, 10)
     self.w.addItem(gy)
     gz = gl.GLGridItem()
     gz.translate(10, 10, 0)
     self.w.addItem(gz)
     self.curve1 = gl.GLLinePlotItem()
     self.curve2 = gl.GLLinePlotItem()
     self.curve3 = gl.GLLinePlotItem()
     self.w.addItem(self.curve1)
     self.w.addItem(self.curve2)
     self.w.addItem(self.curve3)
     self.pca = decomposition.PCA(n_components=3)
     self.traces = dict()
     for i in range(N):
         pts = np.array([0, 0, 0]) / 14
         self.traces[i] = gl.GLScatterPlotItem(pos=pts,
                                               color=pg.glColor(
                                                   100, 100, 100, 100))
         self.w.addItem(self.traces[i])
Example #18
0
 def __init__(self):
     self.traces = dict()
     self.app = QtGui.QApplication(sys.argv)
     self.w = gl.GLViewWidget()
     self.w.opts['distance'] = 50
     self.w.setWindowTitle('projekt 2')
     self.w.setGeometry(0, 80, 1020, 980)
     self.w.show()
     gx = gl.GLGridItem()
     gx.rotate(90, 0, 1, 0)
     gx.translate(-10, 0, 0)
     self.w.addItem(gx)
     gy = gl.GLGridItem()
     gy.rotate(90, 1, 0, 0)
     gy.translate(0, -10, 0)
     self.w.addItem(gy)
     gz = gl.GLGridItem()
     gz.translate(0, 0, -10)
     self.w.addItem(gz)
     self.n = 50
     self.m = 1000
     self.y = np.linspace(-10, 10, self.n)
     self.x = np.linspace(-10, 10, self.m)
     self.phase = 0
     for i in range(self.n):
         yi = np.array([self.y[i]] * self.m)
         d = np.sqrt(self.x**2 + yi**2)
         z = 12 * np.cos(d + self.phase) / (d + 1)
         pts = np.vstack([self.x, yi, z]).transpose()
         self.traces[i] = gl.GLLinePlotItem(pos=pts,
                                            color=pg.glColor(
                                                (i, self.n * 1.3)),
                                            width=(i + 1) / 10,
                                            antialias=True)
         self.w.addItem(self.traces[i])
    def update(self):

        for i in range(self.n):

            yi = np.array([self.y[i]] * self.m)

            u_current = CartesianOXtoCylindricalU(self.grad_x[i], yi)[i]
            y_plot_c = CartesianOYtoCylindricalV(yi, self.x[i])

            alpha = np.mean([x_p.real for x_p in DFT(PhillipsPotential(self.x[i] + self.phase, yi[0]))])

            grad_u = u_current*np.cos(THETA)*u_current + y_plot_c[i]*np.sin(THETA)
            grad_v = u_current*np.sin(THETA)*u_current - y_plot_c[i]*np.cos(THETA)

            z = Grid(u_current, y_plot_c) * alpha * Gaussian() * 1.0 / np.sqrt(2.0) + alpha * Grid(u_current, y_plot_c) + np.cos(np.pi*(2.0*grad_v - 0.5) * b_n_series(grad_u, self.phase)) + \
                np.cos(self.x[i] - self.phase) * np.sin(self.y[i] + self.phase)

            self.z[i] = z[i]

            #print('X = {}\tY = {}\tZ = {}'.format(self.x[i], y_plot_c[i], self.z[i]))

            points = np.vstack([self.x, y_plot_c, self.z]).transpose()
            self.set_plotdata(name=i, points=points, color=pg.glColor((OCEAN_COLOR, 100)), width=self.xoy_grid_width*2)

            #diffusion ~= -E_system velocity
            self.phase -= .004
Example #20
0
 def setColor(self, color):
     """
     Set the color of the grid. Arguments are the same as those accepted by
     :func:`glColor <pyqtgraph.glColor>`.
     """
     self.color = pg.glColor(color)
     self.update()
Example #21
0
 def setRootTrack(self, trackPath):
     global trackData
     trackData.loadData(trackPath)
     self.treeWidget.setTrackInfo(trackData.tree)
     for key in trackData.dataDic:
         # 这里要注意openGL内的坐标系为右手系,向左是X轴,向上是Y轴,垂直屏幕向外是Z轴。为匹配各方向投影的2D图像,
         # x轴为负的水平坐标,y轴为上下位移,z轴为左右位移
         dataCoordinate = np.vstack([
             -trackData.dataDic[key][dataHead[4]],
             trackData.dataDic[key][dataHead[6]],
             trackData.dataDic[key][dataHead[5]]
         ]).transpose()
         d = pl.GLLinePlotItem(pos=dataCoordinate,
                               color=pg.glColor('b'),
                               width=2,
                               antialias=True)
         self.threeDwidget.addItem(d)
         xplot = self.widget_x.plotItem.plot()
         xplot.setData(x=trackData.dataDic[key][dataHead[4]].values,
                       y=trackData.dataDic[key][dataHead[5]].values)
         yplot = self.widget_y.plotItem.plot()
         yplot.setData(x=trackData.dataDic[key][dataHead[6]].values,
                       y=trackData.dataDic[key][dataHead[4]].values)
         zplot = self.widget_z.plotItem.plot()
         zplot.setData(x=trackData.dataDic[key][dataHead[6]].values,
                       y=trackData.dataDic[key][dataHead[5]].values)
Example #22
0
 def set_color(self, color):
     """
     Set the color of the grid. Arguments are the same as those accepted by
     pyqtgraph.glColor method
     """
     self.color = pg.glColor(color)
     self.update()
    def __init__(self):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 40
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(0, 110, 1920, 1080)
        self.w.show()

        self.phase = 0
        self.lines = 50
        self.points = 1000
        self.y = np.linspace(-10, 10, self.lines)
        self.x = np.linspace(-10, 10, self.points)

        for i, line in enumerate(self.y):
            y = np.array([line] * self.points)
            d = np.sqrt(self.x**2 + y**2)
            sine = 10 * np.sin(d + self.phase)
            pts = np.vstack([self.x, y, sine]).transpose()
            self.traces[i] = gl.GLLinePlotItem(pos=pts,
                                               color=pg.glColor(
                                                   (i, self.lines * 1.3)),
                                               width=(i + 1) / 10,
                                               antialias=True)
            self.w.addItem(self.traces[i])
Example #24
0
    def __init__(self, data, n=50, scale=1):
        PgDataPlot.__init__(self, data)

        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 40
        self.w.show()
        self.w.setWindowTitle(data[0].name)

        # grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(-10, 0, 0)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -10, 0)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(0, 0, -10)
        self.w.addItem(gz)

        res = self._data[0]
        z_vals = res.input_data[1][::-1] * scale

        t_subsets = np.linspace(0, np.array(res.input_data[0]).size, n, endpoint=False, dtype=int)

        for t_idx, t_val in enumerate(t_subsets):
            t_vals = np.array([res.input_data[0][t_val]] * len(z_vals))
            pts = np.vstack([t_vals, z_vals, res.output_data[t_val, :]]).transpose()
            plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((t_idx, n * 1.3)),
                                    # width=(t_idx + 1) / 10.,
                                    width=2,
                                    antialias=True)
            self.w.addItem(plt)
Example #25
0
    def draw_goals(self):
        """
        Desc: draws the goals in the viewer

        Input(s):
            none
        Output(s):
            none
        """
        self.goals_3d = []
        for goal in self.gridworld.goals:
            cyl_height = 2. * self.gridworld.world_delta
            cyl_radius = 0.8 * (self.gridworld.world_delta / 2.)
            cyl_object = gl.MeshData.cylinder(rows=100,
                                              cols=100,
                                              radius=[cyl_radius, cyl_radius],
                                              length=cyl_height)
            cyl_color = pg.glColor('g')
            goal_3d = gl.GLMeshItem(meshdata=cyl_object,
                                    smooth=True,
                                    drawFaces=True,
                                    drawEdges=False,
                                    color=cyl_color)
            goal_3d.translate(goal.pos[0] + self.offset,
                              goal.pos[1] + self.offset, 0)
            self.w.addItem(goal_3d)
            self.goals_3d.append(goal_3d)
    def __init__(self, num_lines, window_title="Line Plot", distance=40, elevation=90, fov=60, azimuth=0):
        self.numLines = num_lines
        self.windowTitle = window_title

        # Create Window
        self.win = gl.GLViewWidget()
        self.win.opts['distance'] = distance
        self.win.opts['elevation'] = elevation
        self.win.opts['fov'] = fov
        self.win.opts['azimuth'] = azimuth
        self.win.show()
        self.win.setWindowTitle(self.windowTitle)

        # Add Grid Lines
        self.gx = gl.GLGridItem()  # Ignored unresolved item GLGridItem
        self.gx.rotate(90, 0, 1, 0)
        self.gx.translate(-10, 0, 0)
        self.win.addItem(self.gx)
        self.gy = gl.GLGridItem()  # Ignored unresolved item GLGridItem
        self.gy.rotate(90, 1, 0, 0)
        self.gy.translate(0, -10, 0)
        self.win.addItem(self.gy)
        self.gz = gl.GLGridItem()  # Ignored unresolved item GLGridItem
        self.gz.translate(0, 0, -10)
        self.win.addItem(self.gz)

        self.pts = []
        self.plts = []
        for i in range(self.numLines):
            self.pts.append(np.vstack([[], [], []]).transpose())
            # Ignored unresolved item GLLinePlotItem
            self.plts.append(gl.GLLinePlotItem(color=pg.glColor((i, self.numLines*1.3)), antialias=True))
            self.win.addItem(self.plts[i])
Example #27
0
    def update_cylinders(self, cyl_info, centriods, p):
        # cyl_info - clusters x 5
        # centroids - 3 x clusters
        for i in range(self.clusters):
            vec = cyl_info[i, :3]
            vec = vec / (np.sum(np.power(vec, 2))**0.5)
            r = (cyl_info[i, 3]**0.5) / 14
            l = (cyl_info[i, 4]**0.5) / 14

            self.cyl[i].resetTransform()
            CYL = gl.MeshData.cylinder(rows=10,
                                       cols=20,
                                       radius=[r, r],
                                       length=2 * l)
            self.cyl[i].setMeshData(meshdata=CYL)
            self.cyl[i].setColor(
                pg.glColor(255, 255, 255,
                           np.average(p[:, i]) * 100))

            a = np.rad2deg(np.arccos(vec[2] / (np.sum(vec**2)**0.5)))
            self.cyl[i].rotate(a, -vec[0], vec[1], 0)
            c = [
                centriods[0, i] / 14 - vec[0] * l,
                centriods[1, i] / 14 - vec[1] * l,
                centriods[2, i] / 14 - vec[2] * l
            ]
            self.cyl[i].translate(c[0], c[1], c[2])
Example #28
0
def showPC(point_cloud, bbox3D_label=None, prediction_label=None):
    """
    Show point cloud using pyqtopengl,
    bbox3D_label is a ndarray(n, 7) --> (x, y, z, l, w, h, yaw_angle)
    """
    app = QtGui.QApplication([])
    pg.mkQApp()
    pg.setConfigOption('background', 'w')
    pg.setConfigOption('foreground', 'k')
    view_widget = gl.GLViewWidget()
    view_widget.show()
    xgrid = gl.GLGridItem()
    ygrid = gl.GLGridItem()
    zgrid = gl.GLGridItem()
    view_widget.addItem(xgrid)
    view_widget.addItem(ygrid)
    view_widget.addItem(zgrid)

    line = gl.GLLinePlotItem()
    view_widget.addItem(line)

    xgrid.rotate(90, 0, 1, 0)
    ygrid.rotate(90, 1, 0, 0)

    x = point_cloud[:, 0]
    y = point_cloud[:, 1]
    z = point_cloud[:, 2]
    selected_area = np.where((y > 0))[0]
    specified_area = np.where((z > -2.0) & (z < 2.5) & (x > 30) & (x < 35))[0]
    #n, bins, patches = plt.hist(point_cloud[selected_area, 3], 10, normed=1, facecolor='green', alpha=0.75)
    #plt.show()
    scatter_plot = gl.GLScatterPlotItem(pos=point_cloud[:, :3],
                                        color=pg.glColor('g'),
                                        size=0.5)
    view_widget.addItem(scatter_plot)
    if bbox3D_label is not None:
        #mkPen('y', width = 3, stype=QtCore.Qt.DashLine)
        bbox3D_corners = center_to_corner_box3d(bbox3D_label)
        draw3DBox(view_widget, bbox3D_corners)

    if prediction_label is not None:
        #mkPen('y', width = 3, stype=QtCore.Qt.DashLine)
        bbox3D_corners = center_to_corner_box3d(prediction_label)
        draw3DBox(view_widget, bbox3D_corners, color=pg.glColor('b'))

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
    def __init__(self, map, voronoi=None):
        self.scale = 4000
        # initialize Qt gui application and window
        self.app = pg.QtGui.QApplication([])  # initialize QT
        self.window = gl.GLViewWidget()  # initialize the view object
        self.window.setWindowTitle('World Viewer')
        #self.window.setGeometry(0, 0, 1500, 1500)  # args: upper_left_x, upper_right_y, width, height
        sg = QtWidgets.QDesktopWidget().availableGeometry()
        self.window.setGeometry(sg.width() / 2., 0,
                                sg.width() / 2., sg.height())
        grid = gl.GLGridItem()  # make a grid to represent the ground
        grid.scale(self.scale / 20, self.scale / 20, self.scale /
                   20)  # set the size of the grid (distance between each line)
        self.window.addItem(grid)  # add grid to viewer
        self.window.setCameraPosition(distance=self.scale,
                                      elevation=50,
                                      azimuth=-90)
        self.window.setBackgroundColor('k')  # set background color to black
        self.window.show()  # display configured window
        self.window.raise_()  # bring window to the front
        self.plot_initialized = False  # has the mav been plotted yet?
        # get points that define the non-rotated, non-translated mav and the mesh colors
        self.mav_points, self.mav_meshColors = self.get_mav_points()
        # dubins path parameters
        self.dubins_path = dubins_parameters()
        self.mav_body = []

        if voronoi != None:
            self.voronoi = voronoi
            vm_all_pts = self.voronoi.E_inf
            self.vm_all = gl.GLLinePlotItem(pos=vm_all_pts,
                                            color=pg.glColor('w'),
                                            width=1.0,
                                            mode='lines')
            self.window.addItem(self.vm_all)
            vm_pts = self.voronoi.E
            self.vm = gl.GLLinePlotItem(pos=vm_pts,
                                        color=pg.glColor('y'),
                                        width=1.0,
                                        mode='lines')
            self.window.addItem(self.vm)
            #vm_path_pts = self.voronoi.path_pts
            #self.vm_path = gl.GLLinePlotItem(pos=vm_path_pts,color=pg.glColor('m'),width=4.0,mode='lines')
            #self.window.addItem(self.vm_path)

        # draw map
        self.drawMap(map)
        self.initialized_RRT = False
        self.RRT_iteration = 0
        self.RRT_colors = [
            pg.glColor('y'),
            pg.glColor('g'),
            pg.glColor('b'),
            pg.glColor('w'),
            pg.glColor('r'),
            pg.glColor('m')
        ]
Example #30
0
 def acq_loop():
     for i, frame in enumerate(mythen.acquire()):
         yi = np.array([y[i]] * frame.size)
         data = dict(
             frame=frame,
             line=np.vstack((x, yi, frame)).T,
             color=pg.glColor((i, n * 1.3)))
         qmythen.newFrame.emit(data)
Example #31
0
 def update(self):
     connectome_data_fetcher(cortical_area)
     data_points = self.pts.shape[0]
     for i in range(data_points):
         self.set_plotdata(name=i,
                           points=self.pts,
                           color=pg.glColor((i, 100)),
                           size=3)
def plot_line(x, y, z, color='w'):
    # first line
    p = np.array([z, x, y])
    p = p.transpose()
    C = pg.glColor(color)
    #plt = gl.GLScatterPlotItem(pos=p, color=C, size =2.5)
    plt = gl.GLLinePlotItem(pos=p, color=C, width=1.5, antialias=True)
    return plt
Example #33
0
    def _refresh_plot(self):
        import numpy as np
        import pyqtgraph as pg
        from pyqtgraph import opengl as gl
        
        self._create_grid()
        n = 51
        x = self.declaration.x
        y = self.declaration.y
        for i in range(n):
            yi = np.array([y[i]]*100)
            d = (x**2 + yi**2)**0.5
            z = 10 * np.cos(d) / (d+1)
            pts = np.vstack([x,yi,z]).transpose()
            plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
        self.widget.addItem(plt)
        
        

#     def set_data(self,data):
#         self.widget.plotItem.clear()
#         if self._views:
#             for view in self._views:
#                 view.clear()
#             
#         views = []
#         i = 0
#         if self.declaration.multi_axis:
#             for i,plot in enumerate(data):
#                 if i>3:
#                     break
#                 if 'pen' not in plot:
#                     plot['pen'] = self._colors[i]
#                 if i>0:
#                     view = ViewBox()
#                     views.append(view)
#                     self.widget.plotItem.scene().addItem(view)
#                     if i==1:
#                         axis = self.widget.plotItem.getAxis('right')
#                     elif i>1:
#                         axis = AxisItem('right')
#                         axis.setZValue(-10000)
#                         self.widget.plotItem.layout.addItem(axis,2,3)
#                     axis.linkToView(view)
#                     view.setXLink(self.widget.plotItem)
#                     view.addItem(PlotCurveItem(**plot))
#                 else:    #view.setYLink(self.widget.plotItem)
#                     self.widget.plot(**plot)
#         if i>0:
#             def syncViews():
#                 for v in views:
#                     v.setGeometry(self.widget.plotItem.vb.sceneBoundingRect())
#                     v.linkedViewChanged(self.widget.plotItem.vb,v.XAxis)
#             syncViews()
#             self.widget.plotItem.vb.sigResized.connect(syncViews)
#         self._views = views
            
    def __drawSynapse(self, segment, synapse, segmentIsVisible):

        if synapse.isRemoved[Global.selStep]:
            if synapse.tree3d_item in self.viewer.items:
                self.viewer.removeItem(synapse.tree3d_item)
        else:
            # Update properties according to state
            isVisible = True
            if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesNone.isChecked()) or (
                segment.type == SegmentType.distal and self.menuShowDistalSynapsesNone.isChecked()
            ):
                isVisible = False
            elif synapse.isPredicted[Global.selStep]:
                if segment.type == SegmentType.proximal and self.menuShowProximalSynapsesPredicted.isChecked():
                    color = self.colorSynapsePredicted
                else:
                    isVisible = False
            elif synapse.isConnected[Global.selStep]:
                if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesConnected.isChecked()) or (
                    segment.type == SegmentType.distal and self.menuShowDistalSynapsesConnected.isChecked()
                ):
                    color = self.colorSynapseConnected
                else:
                    isVisible = False
            else:
                if (segment.type == SegmentType.proximal and self.menuShowProximalSynapsesActive.isChecked()) or (
                    segment.type == SegmentType.distal and self.menuShowDistalSynapsesActive.isChecked()
                ):
                    color = self.colorInactive
                else:
                    isVisible = False

            if isVisible and segmentIsVisible:
                # Draw the synapse
                if not synapse.tree3d_initialized:
                    pts = numpy.array(
                        [
                            [segment.tree3d_x2, segment.tree3d_y2, segment.tree3d_z2],
                            [synapse.inputElem.tree3d_x, synapse.inputElem.tree3d_y, synapse.inputElem.tree3d_z],
                        ]
                    )
                    synapse.tree3d_item = gl.GLLinePlotItem(pos=pts, width=1, antialias=False)
                    synapse.tree3d_initialized = True
                    self.viewer.addItem(synapse.tree3d_item)

                    # Update the color
                if synapse.tree3d_selected:
                    color = self.colorSelected
                synapse.tree3d_item.color = pg.glColor(color)
            else:
                synapse.tree3d_initialized = False
                if synapse.tree3d_item in self.viewer.items:
                    self.viewer.removeItem(synapse.tree3d_item)
    def __drawSegment(self, segment):

        isVisible = True
        if segment.isRemoved[Global.selStep] and segment.tree3d_item in self.viewer.items:
            self.viewer.removeItem(segment.tree3d_item)
        else:
            # Update properties according to state
            if (segment.type == SegmentType.proximal and self.menuShowProximalSegmentsNone.isChecked()) or (
                segment.type == SegmentType.distal and self.menuShowDistalSegmentsNone.isChecked()
            ):
                isVisible = False
            elif segment.isPredicted[Global.selStep]:
                if segment.type == SegmentType.proximal and self.menuShowProximalSegmentsPredicted.isChecked():
                    color = self.colorSegmentPredicted
                else:
                    isVisible = False
            elif segment.isActive[Global.selStep]:
                if (segment.type == SegmentType.proximal and self.menuShowProximalSegmentsActive.isChecked()) or (
                    segment.type == SegmentType.distal and self.menuShowDistalSegmentsActive.isChecked()
                ):
                    color = self.colorSegmentActive
                else:
                    isVisible = False
            else:
                isVisible = False

            if isVisible:
                # Draw the segment
                if not segment.tree3d_initialized:
                    pts = numpy.array(
                        [
                            [segment.tree3d_x1, segment.tree3d_y1, segment.tree3d_z1],
                            [segment.tree3d_x2, segment.tree3d_y2, segment.tree3d_z2],
                        ]
                    )
                    segment.tree3d_item = gl.GLLinePlotItem(pos=pts, width=2, antialias=True)
                    segment.tree3d_initialized = True
                    self.viewer.addItem(segment.tree3d_item)

                    # Update the color
                if segment.tree3d_selected:
                    color = self.colorSelected
                segment.tree3d_item.color = pg.glColor(color)
            else:
                segment.tree3d_initialized = False
                if segment.tree3d_item in self.viewer.items:
                    self.viewer.removeItem(segment.tree3d_item)

                    # Draw/update all synapses of this segment
        for synapse in segment.synapses:
            self.__drawSynapse(segment, synapse, isVisible)
Example #36
0
    def plot_data(self, X, y):
        self.clear_plot()

        # get the simple cross validation score
        clf = LDA()
        scores = cross_validation.cross_val_score(clf, X, y, cv=5)
        score = np.mean(scores)
        self.ui.titleLabel.setText("Accuracy: %.2f" % score)

        # project the data to 3D for visualization
        clf = LDA(n_components=3)
        X_proj = clf.fit(X, y).transform(X)

        labels = sorted(np.unique(y))
        for i in labels:
            plot = gl.GLScatterPlotItem(
                pos=X_proj[y == i], color=pg.glColor(pg.intColor(i)))
            self.plotWidget.addItem(plot)
            self.plot_items.append(plot)
Example #37
0
 def paint(self):
     self.setupGLState()
     
     self.parseMeshData()        
     
     with self.shader():
         verts = self.vertexes
         norms = self.normals
         color = self.colors
         faces = self.faces
         if verts is None:
             return
         glEnableClientState(GL_VERTEX_ARRAY)
         try:
             glVertexPointerf(verts)
             
             if self.colors is None:
                 color = self.opts['color']
                 if isinstance(color, QtGui.QColor):
                     glColor4f(*pg.glColor(color))
                 else:
                     glColor4f(*color)
             else:
                 glEnableClientState(GL_COLOR_ARRAY)
                 glColorPointerf(color)
             
             
             if norms is not None:
                 glEnableClientState(GL_NORMAL_ARRAY)
                 glNormalPointerf(norms)
             
             if faces is None:
                 glDrawArrays(GL_TRIANGLES, 0, np.product(verts.shape[:-1]))
             else:
                 faces = faces.astype(np.uint).flatten()
                 glDrawElements(GL_TRIANGLES, faces.shape[0], GL_UNSIGNED_INT, faces)
         finally:
             glDisableClientState(GL_NORMAL_ARRAY)
             glDisableClientState(GL_VERTEX_ARRAY)
             glDisableClientState(GL_COLOR_ARRAY)
Example #38
0
	def addLinePlot(self, x, y, z, color=pg.glColor(Colors.Red), width=2):
		self.removeItem
		pts = np.vstack([x,y,z]).transpose()
		self.plt = gl.GLLinePlotItem(pos=pts, color=color, width=width, antialias=True)
		self.addItem(self.plt)
		return 0
Example #39
0
w.addItem(gx)
gy = gl.GLGridItem()
gy.rotate(90, 1, 0, 0)
gy.translate(0, -10, 0)
w.addItem(gy)
gz = gl.GLGridItem()
gz.translate(0, 0, -10)
w.addItem(gz)

def fn(x, y):
    return np.cos((x**2 + y**2)**0.5)

n = 51
y = np.linspace(-10,10,n)
x = np.linspace(-10,10,100)
for i in range(n):
    yi = np.array([y[i]]*100)
    d = (x**2 + yi**2)**0.5
    z = 10 * np.cos(d) / (d+1)
    pts = np.vstack([x,yi,z]).transpose()
    plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)), width=(i+1)/10., antialias=True)
    w.addItem(plt)
    


## Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
Example #40
0
def pg_plot_graph(G, show_edges=None):
    r"""
    Plot a graph or an array of graphs.

    See plot_graph for full documentation.

    """
    # TODO handling when G is a list of graphs
    global window_list
    if 'window_list' not in globals():
        window_list = {}

    if show_edges is None:
        show_edges = G.Ne < 10000

    ki, kj = np.nonzero(G.A)
    if G.directed:
        raise NotImplementedError('TODO')
        if G.coords.shape[1] == 2:
            raise NotImplementedError('TODO')
        else:
            raise NotImplementedError('TODO')
    else:
        if G.coords.shape[1] == 2:
            adj = np.concatenate((np.expand_dims(ki, axis=1),
                                  np.expand_dims(kj, axis=1)), axis=1)

            w = pg.GraphicsWindow()
            w.setWindowTitle(G.plotting['plot_name'] or G.gtype if 'plot_name' in G.plotting else G.gtype)
            v = w.addViewBox()
            v.setAspectLocked()

            extra_args = {}
            if isinstance(G.plotting['vertex_color'], list):
                extra_args['symbolPen'] = [pg.mkPen(v_col) for v_col in G.plotting['vertex_color']]
                extra_args['brush'] = [pg.mkBrush(v_col) for v_col in G.plotting['vertex_color']]
            elif isinstance(G.plotting['vertex_color'], int):
                extra_args['symbolPen'] = G.plotting['vertex_color']
                extra_args['brush'] = G.plotting['vertex_color']

            # Define syntaxic sugar mapping keywords for the display options
            for plot_args, pg_args in [('vertex_size', 'size'), ('vertex_mask', 'mask'), ('edge_color', 'pen')]:
                if plot_args in G.plotting:
                    G.plotting[pg_args] = G.plotting.pop(plot_args)

            for pg_args in ['size', 'mask', 'pen', 'symbolPen']:
                if pg_args in G.plotting:
                    extra_args[pg_args] = G.plotting[pg_args]

            if not show_edges:
                extra_args['pen'] = None

            g = pg.GraphItem(pos=G.coords, adj=adj, **extra_args)
            v.addItem(g)

            window_list[str(uuid.uuid4())] = w

        elif G.coords.shape[1] == 3:
            app = QtGui.QApplication([])
            w = gl.GLViewWidget()
            w.opts['distance'] = 10
            w.show()
            w.setWindowTitle(G.plotting['plot_name'] or G.gtype if 'plot_name' in G.plotting else G.gtype)

            # Very dirty way to display a 3d graph
            x = np.concatenate((np.expand_dims(G.coords[ki, 0], axis=0),
                                np.expand_dims(G.coords[kj, 0], axis=0)))
            y = np.concatenate((np.expand_dims(G.coords[ki, 1], axis=0),
                                np.expand_dims(G.coords[kj, 1], axis=0)))
            z = np.concatenate((np.expand_dims(G.coords[ki, 2], axis=0),
                                np.expand_dims(G.coords[kj, 2], axis=0)))
            ii = range(0, x.shape[1])
            x2 = np.ndarray((0, 1))
            y2 = np.ndarray((0, 1))
            z2 = np.ndarray((0, 1))
            for i in ii:
                x2 = np.append(x2, x[:, i])
            for i in ii:
                y2 = np.append(y2, y[:, i])
            for i in ii:
                z2 = np.append(z2, z[:, i])

            pts = np.concatenate((np.expand_dims(x2, axis=1),
                                  np.expand_dims(y2, axis=1),
                                  np.expand_dims(z2, axis=1)), axis=1)

            extra_args = {'color': (1., 0., 0., 1)}
            if 'vertex_color' in G.plotting:
                if isinstance(G.plotting['vertex_color'], list):
                    extra_args['color'] = np.array([pg.glColor(pg.mkPen(v_col).color()) for v_col in  G.plotting['vertex_color']])
                elif isinstance(G.plotting['vertex_color'], int):
                    extra_args['color'] = pg.glColor(pg.mkPen(G.plotting['vertex_color']).color())
                else:
                    extra_args['color'] = G.plotting['vertex_color']

            # Define syntaxic sugar mapping keywords for the display options
            for plot_args, pg_args in [('vertex_size', 'size')]:
                if plot_args in G.plotting:
                    G.plotting[pg_args] = G.plotting.pop(plot_args)

            for pg_args in ['size']:
                if pg_args in G.plotting:
                    extra_args[pg_args] = G.plotting[pg_args]

            if show_edges:
                g = gl.GLLinePlotItem(pos=pts, mode='lines', color=G.plotting['edge_color'])
                w.addItem(g)

            gp = gl.GLScatterPlotItem(pos=G.coords, **extra_args)
            w.addItem(gp)

            window_list[str(uuid.uuid4())] = app
Example #41
0
 def plot_result(self):
     self.plot_widget.append(Plot())
     self.plot3d_widget.append(gl.GLViewWidget())#(GLViewer())#(Plot3D())
     if len(self.plot_widget) >= 2:
         self.plot_widget.pop(0)
     if len(self.plot3d_widget) >= 2:
         self.plot3d_widget.pop(0)
     if self.resultcontainer.results["dim"]:#self.resultcontainer.chk_2dor3d == True:
         self.plot_widget[-1].show()
         p = self.plot_widget[-1].plotw.addPlot(row=0, col=0)
         p.addLegend()
         p.showGrid(True, True)
         for i in range(len(self.resultcontainer.results["planets"])):
             self.plot.append(p.plot(x=self.resultcontainer.results["planets"][i]["x"],\
                                     y=self.resultcontainer.results["planets"][i]["y"],\
                                     pen=(255/len(self.resultcontainer.results["planets"])*(i+1),
                                          255/len(self.resultcontainer.results["planets"])*i,
                                          255/len(self.resultcontainer.results["planets"])*(len(self.resultcontainer.results["planets"])-i-1)),\
                                     name=self.resultcontainer.results["planets"][i]["name"]))
             self.arrow.append(pg.CurveArrow(self.plot[i]))
             self.text.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"], anchor=(0.5, -1.0)))
             #self.arrow.append(pg.ArrowItem())
             self.initarrow.append(pg.ArrowItem())
             self.inittext.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"]+" Init",anchor=(0.5, -1.0)))
             self.arrow_here_xy.append(pg.ArrowItem())
             #self.text_here_xy.append(pg.TextItem("Here", anchor=(0.5, -1.0)))
             self.initarrow[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                      self.resultcontainer.results["planets"][i]["y"][0])
             self.inittext[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                     self.resultcontainer.results["planets"][i]["y"][0])
             #p.addItem(arrow[i])
             self.text[i].setParentItem(self.arrow[i])
             self.initarrow[i].setParentItem(self.plot[i])
             p.addItem(self.inittext[i])
             self.arrow_here_xy[i].setParentItem(self.plot[i])
             #p.addItem(initarrow[i])
             self.anim.append(self.arrow[i].makeAnimation(loop=-1))
         for i in range(len(self.resultcontainer.results["planets"])):
             self.anim[i].start()
     else:
         self.plot_widget[-1].resize(450,900)
         self.plot_widget[-1].show()
         p_xy = self.plot_widget[-1].plotw.addPlot(row=0, col=0)
         p_xz = self.plot_widget[-1].plotw.addPlot(row=1, col=0)
         p_yz = self.plot_widget[-1].plotw.addPlot(row=2, col=0)
         p_xy.addLegend()
         #p_xz.addLegend()
         #p_yz.addLegend()
         p_xy.setLabel('left',"Y")
         p_xy.setLabel('bottom',"X")
         p_xz.setLabel('left',"Z")
         p_xz.setLabel('bottom',"X")
         p_yz.setLabel('left',"Z")
         p_yz.setLabel('bottom',"Y")
         p_xy.showGrid(True, True)
         p_xz.showGrid(True, True)
         p_yz.showGrid(True, True)
         for i in range(len(self.resultcontainer.results["planets"])):
             self.plot_xy.append(p_xy.plot(self.resultcontainer.results["planets"][i]["x"],\
                                           self.resultcontainer.results["planets"][i]["y"],\
                                           pen=(255/len(self.resultcontainer.results["planets"])*(i+1),
                                                255/len(self.resultcontainer.results["planets"])*i,
                                                255/len(self.resultcontainer.results["planets"])*(len(self.resultcontainer.results["planets"])-i-1)),\
                                           name=self.resultcontainer.results["planets"][i]["name"]))
             self.plot_xz.append(p_xz.plot(self.resultcontainer.results["planets"][i]["x"],\
                                           self.resultcontainer.results["planets"][i]["z"],\
                                           pen=(255/len(self.resultcontainer.results["planets"])*(i+1),
                                                255/len(self.resultcontainer.results["planets"])*i,
                                                255/len(self.resultcontainer.results["planets"])*(len(self.resultcontainer.results["planets"])-i-1)),\
                                           name=self.resultcontainer.results["planets"][i]["name"]))
             self.plot_yz.append(p_yz.plot(self.resultcontainer.results["planets"][i]["y"],\
                                           self.resultcontainer.results["planets"][i]["z"],\
                                           pen=(255/len(self.resultcontainer.results["planets"])*(i+1),
                                                255/len(self.resultcontainer.results["planets"])*i,
                                                255/len(self.resultcontainer.results["planets"])*(len(self.resultcontainer.results["planets"])-i-1)),\
                                           name=self.resultcontainer.results["planets"][i]["name"]))
             self.arrow_xy.append(pg.CurveArrow(self.plot_xy[i]))
             self.arrow_xz.append(pg.CurveArrow(self.plot_xz[i]))
             self.arrow_yz.append(pg.CurveArrow(self.plot_yz[i]))
             self.text_xy.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"], anchor=(0.5, -1.0)))
             self.text_xz.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"], anchor=(0.5, -1.0)))
             self.text_yz.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"], anchor=(0.5, -1.0)))
             self.initarrow_xy.append(pg.ArrowItem())
             self.initarrow_xz.append(pg.ArrowItem())
             self.initarrow_yz.append(pg.ArrowItem())
             self.inittext_xy.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"]+" Init",anchor=(0.5, -1.0)))
             self.inittext_xz.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"]+" Init",anchor=(0.5, -1.0)))
             self.inittext_yz.append(pg.TextItem(self.resultcontainer.results["planets"][i]["name"]+" Init",anchor=(0.5, -1.0)))
             self.arrow_here_xy.append(pg.ArrowItem())
             self.arrow_here_xz.append(pg.ArrowItem())
             self.arrow_here_yz.append(pg.ArrowItem())
             #self.text_here_xy.append(pg.TextItem("Here", anchor=(0.5, -1.0)))
             #self.text_here_xz.append(pg.TextItem("Here", anchor=(0.5, -1.0)))
             #self.text_here_yz.append(pg.TextItem("Here", anchor=(0.5, -1.0)))
             self.initarrow_xy[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                         self.resultcontainer.results["planets"][i]["y"][0])
             self.initarrow_xz[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                         self.resultcontainer.results["planets"][i]["z"][0])
             self.initarrow_yz[i].setPos(self.resultcontainer.results["planets"][i]["y"][0],\
                                         self.resultcontainer.results["planets"][i]["z"][0])
             self.inittext_xy[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                        self.resultcontainer.results["planets"][i]["y"][0])
             self.inittext_xz[i].setPos(self.resultcontainer.results["planets"][i]["x"][0],\
                                        self.resultcontainer.results["planets"][i]["z"][0])
             self.inittext_yz[i].setPos(self.resultcontainer.results["planets"][i]["y"][0],\
                                        self.resultcontainer.results["planets"][i]["z"][0])
             self.text_xy[i].setParentItem(self.arrow_xy[i])
             self.text_xz[i].setParentItem(self.arrow_xz[i])
             self.text_yz[i].setParentItem(self.arrow_yz[i])
             self.initarrow_xy[i].setParentItem(self.plot_xy[i])
             self.initarrow_xz[i].setParentItem(self.plot_xz[i])
             self.initarrow_yz[i].setParentItem(self.plot_yz[i])
             p_xy.addItem(self.inittext_xy[i])
             p_xz.addItem(self.inittext_xz[i])
             p_yz.addItem(self.inittext_yz[i])
             self.arrow_here_xy[i].setParentItem(self.plot_xy[i])
             self.arrow_here_xz[i].setParentItem(self.plot_xz[i])
             self.arrow_here_yz[i].setParentItem(self.plot_yz[i])
             self.anim_xy.append(self.arrow_xy[i].makeAnimation(loop=-1))
             self.anim_xz.append(self.arrow_xz[i].makeAnimation(loop=-1))
             self.anim_yz.append(self.arrow_yz[i].makeAnimation(loop=-1))
         for i in range(len(self.resultcontainer.results["planets"])):
             self.anim_xy[i].start()
             self.anim_xz[i].start()
             self.anim_yz[i].start()
         self.plot3d_widget[-1].show()
         #self.plot3d_widget[-1].opts['distance'] = 2000
         gx = gl.GLGridItem()
         gx.rotate(90, 0, 1, 0)
         #gx.scale(10,10,10)
         #gx.translate(-10, 0, 0)
         self.plot3d_widget[-1].addItem(gx)#.glplotw.addItem(gx)
         ax = gl.GLAxisItem(antialias=True)
         self.plot3d_widget[-1].addItem(ax)
         gy = gl.GLGridItem()
         gy.rotate(90, 1, 0, 0)
         #gy.translate(0, -10, 0)
         self.plot3d_widget[-1].addItem(gy)#.glplotw.addItem(gy)
         gz = gl.GLGridItem()
         #gz.translate(0, 0, -10)
         self.plot3d_widget[-1].addItem(gz)#.glplotw.addItem(gz)
         for i in range(len(self.resultcontainer.results["planets"])):
             self.pos.append([])
             x = np.array(self.resultcontainer.results["planets"][i]["x"])
             y = np.array(self.resultcontainer.results["planets"][i]["y"])
             z = np.array(self.resultcontainer.results["planets"][i]["z"])
             """self.pos[i] = np.vstack([self.resultcontainer.results["planets"][i]["x"],
                                      self.resultcontainer.results["planets"][i]["y"],
                                      self.resultcontainer.results["planets"][i]["z"]]).transpose()
             """
             self.pos[i] = np.vstack([x,y,z]).transpose()
             self.plot_3d.append(gl.GLLinePlotItem(pos=self.pos[i],\
                                                   color=pg.glColor(255/len(self.resultcontainer.results["planets"])*(i+1),
                                                                    255/len(self.resultcontainer.results["planets"])*i,
                                                                    255/len(self.resultcontainer.results["planets"])*(len(self.resultcontainer.results["planets"])-i-1)),\
                                                   width=1.0,\
                                                   antialias=True))
             self.plot3d_widget[-1].addItem(self.plot_3d[i])#.glplotw.addItem(self.plot_3d[i])
             self.plot3d_widget[-1].qglColor(Qt.white)
             self.plot3d_widget[-1].renderText(self.resultcontainer.results["planets"][i]["x"][0],\
                                               self.resultcontainer.results["planets"][i]["y"][0],\
                                               self.resultcontainer.results["planets"][i]["z"][0],\
                                               self.resultcontainer.results["planets"][i]["name"])
             """for k in range(len(self.resultcontainer.results["planets"][i]["x"])):
                 self.pos[i].append([self.resultcontainer.results["planets"][i]["x"][k],
                                     self.resultcontainer.results["planets"][i]["y"][k],
                                     self.resultcontainer.results["planets"][i]["z"][k]])
             self.plot_3d.append(gl.GLLinePlotItem(pos=self.pos[i], antialias=True))
             self.plot3d_widget[-1].glplotw.addItem(self.plot_3d[i])"""
             """for k in range(len(self.resultcontainer.results["planets"][i]["x"])):
Example #42
0
w.addItem(gx)
gy = gl.GLGridItem()
gy.rotate(90, 1, 0, 0)
gy.translate(0, -10, 0)
w.addItem(gy)
gz = gl.GLGridItem()
gz.translate(0, 0, -10)
w.addItem(gz)

def fn(x, y):
    return np.cos((x**2 + y**2)**0.5)

n = 51
y = np.linspace(-10,10,n)
x = np.linspace(-10,10,100)
for i in range(n):
    yi = np.array([y[i]]*100)
    d = (x**2 + yi**2)**0.5
    z = 10 * np.cos(d) / (d+1)
    pts = np.vstack([x,yi,z]).transpose()
    plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((i,n*1.3)))
    w.addItem(plt)
    


## Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
Example #43
0
	def draw3dLine(self,plot,x,y,z,color=(100,100,100)):
			pts = np.vstack([x,y,z]).transpose()
			plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor(color),width=2)
			plot.addItem(plt)
			plot.plotLines3D.append(plt)
			return plt
gz.translate(0, 0, -10)
w.addItem(gz)


def fn(_x, _y):
    return np.cos((_x**2 + _y**2)**0.5)

n = 1
x = []
y = []
z = []

i = 2
end_i = 100
pts = np.vstack([x, y, z]).transpose()
plt = gl.GLLinePlotItem(pos=pts, color=pg.glColor((192, 255, 238)), width=(i+1)/10., antialias=True)
w.addItem(plt)

timer = QtCore.QTimer()

# Test Object
lpv = LinePlotVisualizer(3, "Test Window")
xa = [[], [], []]
ya = [[], [], []]
za = [[], [], []]

def update():
    global i, pts, plt, x, y, z, timer, xa, ya, za, lpv
    x.append(np.sin(i))
    y.append(np.cos(i))
    z.append(np.sin(i)*i/end_i)
Example #45
0
track_id = data.track_id()
parent_id = data.parent_id()
process = data.process()
start_momentum = data.start_momentum()
trajectory_length = data.trajectory_length()
particle_x = data.particle_x()
particle_y = data.particle_y()
particle_z = data.particle_z()

# Particle colors
# TODO: Figure out a better way to handle this
def default_color():
    return pg.glColor(128, 128, 128, 0)

color_dict = defaultdict(default_color)
red = pg.glColor(255, 0, 0)
green = pg.glColor(0, 255, 0)
blue = pg.glColor(0, 128, 255)
magenta = pg.glColor(255, 0, 255)
maroon = pg.glColor(128, 0, 0)
gold = pg.glColor(255, 215, 0)
olive = pg.glColor(128, 128, 0)
silver = pg.glColor(192, 192, 192, 0)
color_dict.update({ 11:gold, -11:magenta, 13:red, -13:red, 211:green,
                    -211:green, 2212:blue, -2212:blue, 12:silver, -12:silver,
                    14:silver, -14:silver })

ignored_particles = (22, 2112, -2112)
trajectory_length_threshold = 1.0
trajectories = []
Example #46
0
def default_color():
    return pg.glColor(128, 128, 128, 0)
def summary_plot_pulse(feature_list, labels, titles, i, median=False, grand_trace=None, plot=None, color=None, name=None):
    """
    Plots features of single-pulse responses such as amplitude, latency, etc. for group analysis. Can be used for one
    group by ideal for comparing across many groups in the feature_list

    Parameters
    ----------
    feature_list : list of lists of floats
        single-pulse features such as amplitude. Can be multiple features each a list themselves
    labels : list of pyqtgraph.LabelItem
        axis labels, must be a list of same length as feature_list
    titles : list of strings
        plot title, must be a list of same length as feature_list
    i : integer
        iterator to place groups along x-axis
    median : boolean
        to calculate median (True) vs mean (False), default is False
    grand_trace : neuroanalysis.data.TraceView object
        option to plot response trace alongside scatter plot, default is None
    plot : pyqtgraph.PlotItem
        If not None, plot the data on the referenced pyqtgraph object.
    color : tuple
        plot color
    name : pyqtgraph.LegendItem

    Returns
    -------
    plot : pyqtgraph.PlotItem
        2 x n plot with scatter plot and optional trace response plot for each feature (n)

    """
    if type(feature_list) is tuple:
        n_features = len(feature_list)
    else:
        n_features = 1
    if plot is None:
        plot = PlotGrid()
        plot.set_shape(n_features, 2)
        plot.show()
        for g in range(n_features):
            plot[g, 1].addLegend()

    for feature in range(n_features):
        if n_features > 1:
            current_feature = feature_list[feature]
            if median is True:
                mean = np.nanmedian(current_feature)
            else:
                mean = np.nanmean(current_feature)
            label = labels[feature]
            title = titles[feature]
        else:
            current_feature = feature_list
            mean = np.nanmean(current_feature)
            label = labels
            title = titles
        plot[feature, 0].setLabels(left=(label[0], label[1]))
        plot[feature, 0].hideAxis('bottom')
        plot[feature, 0].setTitle(title)
        if grand_trace is not None:
            plot[feature, 1].plot(grand_trace.time_values, grand_trace.data, pen=color, name=name)
        if len(current_feature) > 1:
            dx = pg.pseudoScatter(np.array(current_feature).astype(float), 0.7, bidir=True)
            plot[feature, 0].plot([i], [mean], symbol='o', symbolSize=20, symbolPen='k', symbolBrush=color)
            sem = stats.sem(current_feature, nan_policy='omit')
            if len(color) != 3:
                new_color = pg.glColor(color)
                color = (new_color[0]*255, new_color[1]*255, new_color[2]*255)
            plot[feature, 0].plot((0.3 * dx / dx.max()) + i, current_feature, pen=None, symbol='o', symbolSize=10, symbolPen='w',
                                symbolBrush=(color[0], color[1], color[2], 100))
        else:
            plot[feature, 0].plot([i], current_feature, pen=None, symbol='o', symbolSize=10, symbolPen='w',
                                symbolBrush=color)

    return plot