def make_plot(self, orientation):
        # make some data points
        x = arange(3)
        x = ArrayDataSource(x, sort_order="ascending")
        y = array([2, 0, 1])

        # Plot the data
        pd = ArrayPlotData(x=x, y=y)

        plot = Plot(pd, orientation=orientation)
        line_plot = plot.plot(("x", "y"))[0]

        # Construct a fake screen space for the plots
        # otherwise would need to actually display the plots to get this
        index_mapper = LinearMapper(data_range=DataRange1D(low=0, high=2),
                                    high_pos=380,
                                    low_pos=20)
        value_mapper = LinearMapper(data_range=DataRange1D(low=0, high=2),
                                    high_pos=380,
                                    low_pos=20)
        plot.index_mapper = index_mapper
        plot.value_mapper = value_mapper
        line_plot.index_mapper = index_mapper
        line_plot.value_mapper = value_mapper

        return plot, line_plot
Ejemplo n.º 2
0
    def make_plot(self, orientation):
        # make some data points
        x = arange(3)
        x = ArrayDataSource(x, sort_order="ascending")
        y = array([2,0,1])

        # Plot the data
        pd = ArrayPlotData(x=x, y=y)

        plot = Plot(pd, orientation=orientation)
        line_plot = plot.plot(("x", "y"))[0]

        # Construct a fake screen space for the plots
        # otherwise would need to actually display the plots to get this
        index_mapper = LinearMapper(data_range=DataRange1D(low=0,high=2),
                                    high_pos=380, low_pos=20)
        value_mapper = LinearMapper(data_range=DataRange1D(low=0,high=2),
                                    high_pos=380, low_pos=20)
        plot.index_mapper = index_mapper
        plot.value_mapper = value_mapper
        line_plot.index_mapper = index_mapper
        line_plot.value_mapper = value_mapper

        return  plot, line_plot
Ejemplo n.º 3
0
    def _create_1D1_plot(self):
        index = 0
        plot0 = Plot(self.plotdata, padding=0)
        plot0.padding_left = 5
        plot0.padding_bottom = 5
        Container = OverlayPlotContainer(padding = 50, fill_padding = True, bgcolor = "lightgray", use_backbuffer=True)
        
        y1 =  range(len(self.PCAData.batchs[0].prescores))
        points = []
        for batch in self.PCAData.batchs:
                if (self.active_scores_combobox == "Post Scores"):
                    x1 = self.PCAData.batchs[index].postscores
                else:
                    x1 = self.PCAData.batchs[index].prescores

                    
                if (self.Shape == self.phenotypes[0]):
                    a = 1
                elif (self.Shape == self.phenotypes[1]):
                    a = batch.number
                elif (self.Shape == self.phenotypes[2]):    
                    a = batch.type
                else:
                    a = 0
                    

                if (self.Color == self.phenotypes[0]):
                    b = 0
                elif(self.Color == self.phenotypes[1]):
                    b = batch.number
                elif(self.Color == self.phenotypes[2]): 
                    b = batch.type  
                else:
                    b = 0
                    

                tmarker = shapes[a]   
                bcolor = self.colors[b]
                
                                        
                for i in range(len(x1)):
                    points.append((x1[i],y1[i]))
                plot0 = create_scatter_plot((x1,y1), marker = tmarker, color=getColor(bcolor))
                
                if batch.isSelected:
                    plot0.alpha = 1
                else:
                    plot0.alpha = 0.2
                    
                plot0.bgcolor = "white"
                plot0.border_visible = True
                
                if index == 0:
                    value_mapper = plot0.value_mapper
                    index_mapper = plot0.index_mapper
                    add_default_grids(plot0)
                    add_default_axes(plot0, vtitle='PCA Indices', htitle='PCA Scores')
                    plot0.index_range.tight_bounds = False
                    plot0.index_range.refresh()
                    plot0.value_range.tight_bounds = False
                    plot0.value_range.refresh()
                    plot0.tools.append(PanTool(plot0))
                    zoom = ZoomTool(plot0, tool_mode="box", always_on=False,  maintain_aspect_ratio=False)
                    plot0.overlays.append(zoom)
                    dragzoom = DragZoom(plot0, drag_button="right",  maintain_aspect_ratio=False)
                    plot0.tools.append(dragzoom)
                    
                else:   
                    plot0.value_mapper = value_mapper
                    value_mapper.range.add(plot0.value)
                    plot0.index_mapper = index_mapper
                    index_mapper.range.add(plot0.index)
 
                Container.add(plot0)
                index = index +1

        self.RightPlot = Container                                          
Ejemplo n.º 4
0
    def _create_1D1_plot(self):
        index = 0
        plot0 = Plot(self.plotdata, padding=0)
        plot0.padding_left = 5
        plot0.padding_bottom = 5
        Container = OverlayPlotContainer(padding=50,
                                         fill_padding=True,
                                         bgcolor="lightgray",
                                         use_backbuffer=True)

        y1 = range(len(self.PCAData.batchs[0].prescores))
        points = []
        for batch in self.PCAData.batchs:
            if (self.active_scores_combobox == "Post Scores"):
                x1 = self.PCAData.batchs[index].postscores
            else:
                x1 = self.PCAData.batchs[index].prescores
            '''if (self.Shape == self.phenotypes[0]):
                    a = 1
                elif (self.Shape == self.phenotypes[1]):
                    a = batch.number
                elif (self.Shape == self.phenotypes[2]):    
                    a = batch.type
                else:
                    a = 0
                    

                if (self.Color == self.phenotypes[0]):
                    b = 0
                elif(self.Color == self.phenotypes[1]):
                    b = batch.number
                elif(self.Color == self.phenotypes[2]): 
                    b = batch.type  
                else:
                    b = 0    '''

            a = batch.type
            b = batch.number

            tmarker = shapes[a]
            bcolor = self.colors[b]

            for i in range(len(x1)):
                points.append((x1[i], y1[i]))
            plot0 = create_scatter_plot((x1, y1),
                                        marker=tmarker,
                                        color=getColor(bcolor))

            if batch.isSelected:
                plot0.alpha = 1
                plot0.alpha = 1
            else:
                plot0.fill_alpha = 0.2
                plot0.edge_alpha = 0.2

            plot0.bgcolor = "white"
            plot0.border_visible = True

            if index == 0:
                value_mapper = plot0.value_mapper
                index_mapper = plot0.index_mapper
                add_default_grids(plot0)
                add_default_axes(plot0,
                                 vtitle='PCA Indices',
                                 htitle='PCA Scores')
                plot0.index_range.tight_bounds = False
                plot0.index_range.refresh()
                plot0.value_range.tight_bounds = False
                plot0.value_range.refresh()
                plot0.tools.append(PanTool(plot0))
                zoom = ZoomTool(plot0,
                                tool_mode="box",
                                always_on=False,
                                maintain_aspect_ratio=False)
                plot0.overlays.append(zoom)
                dragzoom = DragZoom(plot0,
                                    drag_button="right",
                                    maintain_aspect_ratio=False)
                plot0.tools.append(dragzoom)

            else:
                plot0.value_mapper = value_mapper
                value_mapper.range.add(plot0.value)
                plot0.index_mapper = index_mapper
                index_mapper.range.add(plot0.index)
            if batch.isSelected:
                Container.add(plot0)
            index = index + 1

        self.RightPlot = Container