当前位置: 首页>>代码示例>>Python>>正文


Python FigureCanvasTkAgg.print_figure方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_tkagg.FigureCanvasTkAgg.print_figure方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasTkAgg.print_figure方法的具体用法?Python FigureCanvasTkAgg.print_figure怎么用?Python FigureCanvasTkAgg.print_figure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_tkagg.FigureCanvasTkAgg的用法示例。


在下文中一共展示了FigureCanvasTkAgg.print_figure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg [as 别名]
# 或者: from matplotlib.backends.backend_tkagg.FigureCanvasTkAgg import print_figure [as 别名]
class PlotFrame:
    def __init__(self, parent):
        self.parent = parent
        # TOP FRAME - CANVAS
        self.f = plt.figure(figsize=(5, 5))
        self.a = self.f.add_subplot(111)
        self.a.grid(True)
        #self.a.set_xlabel(self.description)
        self.a.set_ylabel("Probability")
        self.canvas = FigureCanvasTkAgg(self.f, master=parent)
        self.canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1)
        self.canvas._tkcanvas.pack(side='top', fill='both', expand=1)

    def update(self):
        self.canvas.draw()

    def get_plot(self):
        return self.a

    def plot(self, ext):
        from tkFileDialog import asksaveasfilename
        name = 'puq-plot'
        filename = asksaveasfilename(title="Plot to file...",
                                     initialfile=name,
                                     defaultextension='.%s' % ext,
                                     filetypes=[(ext.upper(), '*.%s' % ext)])
        if not filename:
            return
        self.canvas.print_figure(filename)
开发者ID:zoidy,项目名称:puq,代码行数:31,代码来源:read.py

示例2: drawBatch

# 需要导入模块: from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg [as 别名]
# 或者: from matplotlib.backends.backend_tkagg.FigureCanvasTkAgg import print_figure [as 别名]
def drawBatch(fig,filename):
    canvas=CanvasBackend(fig)    
    canvas.print_figure(filename)
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:5,代码来源:matplotlibLumi.py

示例3: Browse

# 需要导入模块: from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg [as 别名]
# 或者: from matplotlib.backends.backend_tkagg.FigureCanvasTkAgg import print_figure [as 别名]

#.........这里部分代码省略.........
            self.CMAP = 'jet'
        elif self.field == 'spectrum_width':
            self.vminmax = (SW_LIMS[0], SW_LIMS[1])
            self.CMAP = 'gist_ncar'
        elif self.field == 'specific_differential_phase':
            self.vminmax = (PHIDP_LIMS[0], PHIDP_LIMS[1]) 
            self.CMAP = 'RdBu_r'
        elif self.field == 'total_power':
            self.vminmax = (TP_LIMS[0], TP_LIMS[1])
            self.CMAP = 'jet'
           
        limit_strs = ('vmin', 'vmax', 'xmin', 'xmax', 'ymin', 'ymax')
        self.limits = {}
        
        # Now pull the default values
        self.limits['vmin'] = self.vminmax[0]
        self.limits['vmax'] = self.vminmax[1]
        self.limits['xmin'] = self.XRNG[0]
        self.limits['xmax'] = self.XRNG[1]
        self.limits['ymin'] = self.YRNG[0]
        self.limits['ymax'] = self.YRNG[1]
        
#    def _build_cmap_dict(self):
#        self.cmap_dict = {}
#        self.cmap_dict['gist_ncar'] = matcm.get_cmap(name='gist_ncar')
#        self.cmap_dict['RdBu_r'] = matcm.get_cmap(name='RdBu_r')
#        self.cmap_dict['RdYlBu_r'] = matcm.get_cmap(name='RdYlBu_r
#        self.cmap_dict['cool'] = matcm.get_cmap(name='cool
#        self.cmap_dict['YlOrBr'] = matcm.get_cmap(name='YlOrBr
#        self.cmap_dict['jet'] = matcm.get_cmap(name='jet
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
#        self.cmap_dict['
        
        
    def _check_default_field(self):
        '''Hack to perform a check on reflectivity to make it work with 
        a larger number of files
        This should only occur upon start up with a new file'''
        if self.field == 'reflectivity':
            if self.field in self.fieldnames:
                pass
            elif 'CZ' in self.fieldnames:
                self.field = 'CZ'
            elif 'DZ' in self.fieldnames:
                self.field = 'DZ'
            elif 'dbz' in self.fieldnames:
                self.field = 'dbz'
            elif 'DBZ' in self.fieldnames:
                self.field = 'DBZ'
            elif 'dBZ' in self.fieldnames:
                self.field = 'dBZ'
            elif 'Z' in self.fieldnames:
                self.field = 'Z'
            elif 'DBZ_S'in self.fieldnames:
                self.field = 'DBZ_S'
                
    def _check_file_type(self):
        '''Check file to see if the file is airborne or rhi'''
        if self.radar.scan_type == 'rhi':
            try:
                (self.radar.metadata['platform_type'] == 'aircraft_tail') or \
                (self.radar.metadata['platform_type'] == 'aircraft')
                self.airborne = True
            except:
                self.rhi = True
            
            self._set_fig_ax_rhi()
        elif self.radar.scan_type == 'ppi':
            pass
        else:
            print "Check the scan type, ARTview supports PPI and RHI"
            return

    ########################
    # Image save methods #
    ########################

    def _savefile(self, PTYPE=PTYPE):
        '''Save the current display'''
        PNAME = self.display.generate_filename(self.field, self.tilt, ext=PTYPE)
        print "Creating "+ PNAME

        RADNAME = self.radar.metadata['instrument_name']
        self.canvas.print_figure(PNAME, dpi=DPI)
开发者ID:NortySpock,项目名称:artview,代码行数:104,代码来源:artviewtk.py


注:本文中的matplotlib.backends.backend_tkagg.FigureCanvasTkAgg.print_figure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。