Exemple #1
0
 def _create_window(self, title, xtitle, x, ytitle, y, type="line", color="blue"):
     self.plotdata = ArrayPlotData(x=x, y=y)
     plot = ToolbarPlot(self.plotdata)
     plot.plot(('x', 'y'), type=type, color=color)
     plot.title = title
     plot.x_axis.title = xtitle
     plot.y_axis.title = ytitle
     self.plot = plot
     self._hid = 0
     self._colors = ['blue', 'red', 'black', 'green', 'magenta', 'yellow']
     
     # Add some tools
     self.plot.tools.append(PanTool(self.plot, constrain_key="shift"))
     self.plot.overlays.append(ZoomTool(component=self.plot, tool_mode="box", always_on=False))
     
     return Window(self, -1, component=plot)
Exemple #2
0
    def _create_window(self, title, x, y, z, xtitle, ytitle, ztitle):
        '''
        - Left-drag pans the plot.
    	- Mousewheel up and down zooms the plot in and out.
        - Pressing "z" brings up the Zoom Box, and you can click-drag a rectangular
        region to zoom.  If you use a sequence of zoom boxes, pressing alt-left-arrow
        and alt-right-arrow moves you forwards and backwards through the "zoom
        history".
        '''
        # Create window
        self._plotname = title
        self.data = ArrayPlotData()
        self.plot = ToolbarPlot(self.data, hiding=False, auto_hide=False)
        self.update_plot(x, y, z)
        self.plot.title = title
        self.plot.x_axis.title = xtitle
        self.plot.y_axis.title = ytitle
        
        cmap_renderer = self.plot.plots[self._plotname][0]
        
        # Create colorbar
        self._create_colorbar()
        self._colorbar.plot = cmap_renderer
        self._colorbar.padding_top = self.plot.padding_top
        self._colorbar.padding_bottom = self.plot.padding_bottom
        
        # Add some tools
        self.plot.tools.append(PanTool(self.plot, constrain_key="shift"))
        self.plot.overlays.append(ZoomTool(component=self.plot, tool_mode="box", always_on=False))
        
        # Create a container to position the plot and the colorbar side-by-side
        container = HPlotContainer(use_backbuffer = True)
        container.add(self.plot)
        container.add(self._colorbar)
        self.container = container

        # Return a window containing our plot container
        return Window(self, -1, component=self.container)