示例#1
0
 def connect(self, ax):
     canvas = ax.figure.canvas
     self.cids.append(canvas.mpl_connect('motion_notify_event', self.onmove))
     self.cids.append(canvas.mpl_connect('pick_event', self.onpick))
     if self.blit is True:
         self.cids.append(
         canvas.mpl_connect('draw_event', self.update_background))
     self.cids.append(canvas.mpl_connect('button_release_event',
     self.button_release))
     self.axes_manager.connect(self.update_patch_position)
     on_window_close(ax.figure, self.close)
示例#2
0
 def connect(self, ax):
     canvas = ax.figure.canvas
     self.cids.append(canvas.mpl_connect('motion_notify_event',
                                         self.onmove))
     self.cids.append(canvas.mpl_connect('pick_event', self.onpick))
     if self.blit is True:
         self.cids.append(
             canvas.mpl_connect('draw_event', self.update_background))
     self.cids.append(
         canvas.mpl_connect('button_release_event', self.button_release))
     self.axes_manager.connect(self.update_patch_position)
     on_window_close(ax.figure, self.close)
示例#3
0
 def plot_image(self):
     if self.image_plot is not None:
         self.image_plot.plot()
         return
     imf = image.ImagePlot()
     imf.data_function = self.image_data_function
     imf.pixel_units = self.pixel_units
     imf.pixel_size = self.pixel_size
     imf.plot()
     self.image_plot = imf
     
     if self.navigator_plot is not None and imf.figure is not None:
         utils.on_window_close(imf.figure, self.navigator_plot.close)
         self._key_nav_cid = self.image_plot.figure.canvas.mpl_connect(
         'key_press_event', self.axes_manager.key_navigator)
         self._key_nav_cid = self.navigator_plot.figure.canvas.mpl_connect(
         'key_press_event', self.axes_manager.key_navigator)
示例#4
0
    def plot_spectrum(self):
        if self.spectrum_plot is not None:
            self.spectrum_plot.plot()
            return

        # Create the figure
        sf = spectrum.SpectrumFigure()
        sf.xlabel = self.xlabel
        sf.ylabel = self.ylabel
        sf.title = self.spectrum_title
        sf.axis = self.axis
        sf.left_axes_manager = self.axes_manager
        self.spectrum_plot = sf
        # Create a line to the left axis with the default coordinates
        sl = spectrum.SpectrumLine()
        sl.data_function = self.spectrum_data_function
        if self.pointer is not None:
            color = self.pointer.color
        else:
            color = 'red'
        sl.line_properties_helper(color, 'step')
        # Add the line to the figure

        sf.add_line(sl)
        self.spectrum_plot = sf
        sf.plot()
        if self.navigator_plot is not None and sf.figure is not None:
            utils.on_window_close(sf.figure, self.navigator_plot.close)
            self._key_nav_cid = self.spectrum_plot.figure.canvas.mpl_connect(
                'key_press_event', self.axes_manager.key_navigator)
            self._key_nav_cid = self.navigator_plot.figure.canvas.mpl_connect(
                'key_press_event', self.axes_manager.key_navigator)
            self.spectrum_plot.figure.canvas.mpl_connect(
                'key_press_event', self.key2switch_right_pointer)
            self.navigator_plot.figure.canvas.mpl_connect(
                'key_press_event', self.key2switch_right_pointer)
示例#5
0
 def plot_spectrum(self):
     if self.spectrum_plot is not None:
         self.spectrum_plot.plot()
         return
     
     # Create the figure
     sf = spectrum.SpectrumFigure()
     sf.xlabel = self.xlabel
     sf.ylabel = self.ylabel
     sf.title = self.spectrum_title
     sf.axis = self.axis
     sf.left_axes_manager = self.axes_manager
     self.spectrum_plot = sf
     # Create a line to the left axis with the default coordinates
     sl = spectrum.SpectrumLine()
     sl.data_function = self.spectrum_data_function
     if self.pointer is not None:
         color = self.pointer.color
     else:
         color = 'red'
     sl.line_properties_helper(color, 'step')        
     # Add the line to the figure
       
     sf.add_line(sl)
     self.spectrum_plot = sf
     sf.plot()
     if self.navigator_plot is not None and sf.figure is not None:
         utils.on_window_close(sf.figure, self.navigator_plot.close)
         self._key_nav_cid = self.spectrum_plot.figure.canvas.mpl_connect(
         'key_press_event', self.axes_manager.key_navigator)
         self._key_nav_cid = self.navigator_plot.figure.canvas.mpl_connect(
         'key_press_event', self.axes_manager.key_navigator)
         self.spectrum_plot.figure.canvas.mpl_connect(
             'key_press_event', self.key2switch_right_pointer)
         self.navigator_plot.figure.canvas.mpl_connect(
             'key_press_event', self.key2switch_right_pointer)
示例#6
0
 def create_figure(self):
     self.figure = utils.create_figure()
     utils.on_window_close(self.figure, self.close)