示例#1
0
文件: image.py 项目: mfm24/hyperspy
    def plot(self):
        self.configure()
        if not utils.does_figure_object_exists(self.figure):
            self.create_figure()
            self.create_axis()
        data = self.data_function()
        if self.auto_contrast is True:
            self.optimize_contrast(data)
        if (not self.axes_manager or self.axes_manager.navigation_size == 0):
            self.plot_indices = False
        if self.plot_indices is True:
            self._text = self.ax.text(*self._text_position,
                                      s=str(self.axes_manager.indices),
                                      transform=self.ax.transAxes,
                                      fontsize=12,
                                      color='red',
                                      animated=True)
        self.update()
        if self.plot_scalebar is True:
            if self.pixel_units is not None:
                self.ax.scalebar = widgets.Scale_Bar(
                    ax=self.ax,
                    units=self.pixel_units,
                )

        if self.plot_colorbar is True:
            self._colorbar = plt.colorbar(self.ax.images[0], ax=self.ax)
            self._colorbar.ax.yaxis.set_animated(True)

        self.figure.canvas.draw()
        if hasattr(self.figure, 'tight_layout'):
            self.figure.tight_layout()
        self.connect()
示例#2
0
 def plot(self):
     self.configure()
     if not utils.does_figure_object_exists(self.figure):
         self.create_figure()
         self.create_axis()   
     data = self.data_function()
     if self.auto_contrast is True:
         self.optimize_contrast(data)
     if (not self.axes_manager or 
         self.axes_manager.navigation_size==0):
         self.plot_indices = False
     if self.plot_indices is True:
         self._text = self.ax.text(*self._text_position,
                         s=str(self.axes_manager.indices[::-1]),
                         transform = self.ax.transAxes,
                         fontsize=12,
                         color='red')
     self.update_image()
     if self.plot_scalebar is True:
         if self.pixel_units is not None:
             self.ax.scalebar = widgets.Scale_Bar(
                 ax=self.ax,
                 units=self.pixel_units,)
              
     if self.plot_colorbar is True:
         fig = self.ax.figure
         self._colorbar = plt.colorbar(self.ax.images[0], ax=self.ax)
     
     self.figure.canvas.draw()
     if hasattr(self.figure, 'tight_layout'):
         self.figure.tight_layout()
     self.connect()
示例#3
0
文件: widgets.py 项目: mfm24/hyperspy
 def set_on(self, value):
     if value is not self.is_on():
         if value is True:
             self.add_patch_to(self.ax)
             self.connect(self.ax)
         elif value is False:
             for container in [
                     self.ax.patches, self.ax.lines, self.ax.artists,
                     self.ax.texts
             ]:
                 if self.patch in container:
                     container.remove(self.patch)
             self.disconnect(self.ax)
         self.__is_on = value
         if does_figure_object_exists(self.ax.figure):
             self.ax.figure.canvas.draw()
         else:
             self.ax = None
示例#4
0
文件: tools.py 项目: mfm24/hyperspy
 def plot(self):
     if self.signal._plot is None or not \
         does_figure_object_exists(self.signal._plot.signal_plot.figure):
         self.signal.plot()
     hse = self.signal._plot
     l1 = hse.signal_plot.ax_lines[0]
     self.original_color = l1.line.get_color()
     l1.set_line_properties(color=self.original_color, type='scatter')
     l2 = drawing.spectrum.SpectrumLine()
     l2.data_function = self.model2plot
     l2.set_line_properties(color=np.array(self.line_color.Get()) / 255.,
                            type='line')
     # Add the line to the figure
     hse.signal_plot.add_line(l2)
     l2.plot()
     self.data_line = l1
     self.smooth_line = l2
     self.smooth_diff_line = None
示例#5
0
 def set_on(self, value):
     if value is not self.is_on():
         if value is True:
             self.add_patch_to(self.ax)
             self.connect(self.ax)
         elif value is False:
             for container in [
                     self.ax.patches,
                     self.ax.lines,
                     self.ax.artists,
                     self.ax.texts]:
                 if self.patch in container:
                     container.remove(self.patch)
             self.disconnect(self.ax)
         self.__is_on = value
         if does_figure_object_exists(self.ax.figure):
             self.ax.figure.canvas.draw()
         else:
             self.ax = None
示例#6
0
文件: tools.py 项目: iygr/hyperspy
 def plot(self):
     if self.signal._plot is None or not \
         does_figure_object_exists(self.signal._plot.spectrum_plot.figure):
         self.signal.plot()
     hse = self.signal._plot
     l1 = hse.spectrum_plot.ax_lines[0]
     self.original_color = l1.line.get_color()
     l1.line_properties_helper(self.original_color, 'scatter')
     l1.set_properties()
     
     l2 = drawing.spectrum.SpectrumLine()
     l2.data_function = self.model2plot
     l2.line_properties_helper(np.array(
         self.line_color.Get())/255., 'line')   
     # Add the line to the figure
     hse.spectrum_plot.add_line(l2)
     l2.plot()
     self.data_line = l1
     self.smooth_line = l2
     self.smooth_diff_line = None
示例#7
0
文件: image.py 项目: csb60/hyperspy
 def plot(self):
     if not utils.does_figure_object_exists(self.figure):
         self.create_figure()
         self.create_axis()     
     data = self.data_function()
     if self.auto_contrast is True:
         self.optimize_contrast(data)
     self.update_image()
     if self.plot_scale_bar is True:
         if self.pixel_size is not None:
             self.ax.scale_bar = widgets.Scale_Bar(
              ax = self.ax, units = self.pixel_units, 
              pixel_size = self.pixel_size)
     
     # Adjust the size of the window
     #size = [ 6,  6.* data.shape[0] / data.shape[1]]
     #self.figure.set_size_inches(size, forward = True)        
     self.figure.canvas.draw()
     if hasattr(self.figure, 'tight_layout'):
         self.figure.tight_layout()
     self.connect()
示例#8
0
 def close(self):
     if utils.does_figure_object_exists(self.figure) is True:
         plt.close(self.figure)
示例#9
0
 def close(self):
     for line in self.ax_lines + self.right_ax_lines:
         line.close()
     if utils.does_figure_object_exists(self.figure):
         plt.close(self.figure)
示例#10
0
文件: image.py 项目: mfm24/hyperspy
 def close(self):
     self.disconnect()
     if utils.does_figure_object_exists(self.figure) is True:
         plt.close(self.figure)
示例#11
0
文件: image.py 项目: mfm24/hyperspy
 def close(self):
     self.disconnect()
     if utils.does_figure_object_exists(self.figure) is True:
         plt.close(self.figure)
示例#12
0
 def is_active(self):
     return utils.does_figure_object_exists(self.signal_plot.figure)
示例#13
0
 def close(self):
     for line in self.ax_lines + self.right_ax_lines:
         line.close()
     if utils.does_figure_object_exists(self.figure):
         plt.close(self.figure)