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


Python Figure.suptitle方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
    def __init__(self, parent=None, width=8, height=4, dpi=100, title=None):
        # create palette object
        palette = QtGui.QPalette()

        # get background color
        r, g, b, a = palette.color(QtGui.QPalette.Window.Background).toTuple()
        r, g, b, a = map(lambda x: x / 255.0, (r, g, b, a))

        # create figure
        fig = Figure(figsize=(width, height), dpi=dpi, facecolor=(r, g, b))

        # create single plot
        self.axes = fig.add_subplot(111)

        # We want the axes cleared every time plot() is called
        self.axes.hold(False)

        # set title
        if title != None:
            fig.suptitle(title, fontsize=12)

        # call base class constructor
        super(matplotlibCanvas, self).__init__(fig)
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,
                QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
开发者ID:pgebhardt,项目名称:pyfdtd-gui,代码行数:30,代码来源:plot.py

示例2: konto_graph

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def konto_graph(request, year, konto_id):
    from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
    from matplotlib.figure import Figure
    from matplotlib.dates import DateFormatter
    # Collect data
    konto = Konto.objects.get(pk = konto_id)
    innslags = konto.innslag.order_by('bilag__dato').filter(bilag__dato__year = year)
    # make plot
    fig=Figure()
    fig.suptitle(u"%s (År:%s)"% (konto, unicode(year)))
    ax=fig.add_subplot(111)
    x=[]
    y=[]
    sum = Decimal(0)
    for innslag in innslags:
        x.append(innslag.bilag.dato)
        y.append(sum)
        x.append(innslag.bilag.dato)
        sum += innslag.value
        y.append(sum)
    ax.plot_date(x, y, '-')
    if x: # if there is transactions on the konto in the period
        # fill the period from the end of the year with a red line
        ax.plot_date([x[-1],date(int(year),12,31)],[y[-1],y[-1]],"r")
        if x[0].day != 1 or x[0].month != 1:
            ax.plot_date([date(int(year),1,1),x[0]],[0,0],"r")
    else:
        ax.plot_date([date(int(year),1,1),date(int(year),12,31)],[0,0],"r")
    ax.xaxis.set_major_formatter(DateFormatter('%b'))
    fig.autofmt_xdate()
    canvas = FigureCanvas(fig)
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response
开发者ID:mariusnn,项目名称:regnskap,代码行数:36,代码来源:show.py

示例3: make_histogram

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def make_histogram( metrics, outfilename, **kargs ) : 
    
    adjmetrics = np.nan_to_num(metrics)
    nonzero = np.where( adjmetrics != 0 )

#    foo = plt.hist( adjmetrics[nonzero], bins=100, normed=True )
#    plt.show()

    fig = Figure()

    if "title" in kargs : 
        fig.suptitle(kargs["title"])

    ax = fig.add_subplot(111)
    ax.grid()
    ax.hist(np.nan_to_num(metrics),bins=25)
#    ax.hist(np.nan_to_num(metrics),bins=25,normed=True)

    ax.set_xlabel( "Metric" )

    ax.set_xlim(0,1.0)

    canvas = FigureCanvasAgg(fig)
    canvas.print_figure(outfilename)
    print "wrote", outfilename
开发者ID:Rventric,项目名称:page_segmentation,代码行数:27,代码来源:drawgraphs.py

示例4: searchstringPieChart

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def searchstringPieChart(request):
    page_title='Search String Pie Chart'
    year=stat.getYear()
    searchList = list(SearchTerm.objects.values_list('q', flat=True))
    search_string = ' '.join(searchList)
    result = Counter(search_string.split()).most_common(10)
    searchDict = {}
    for key,val in result:
        searchDict[key] = val

    fig=Figure()
    ax=fig.add_subplot(111)

    title='Top Ten search string submitted by user ({0})'.format(year)
    fig.suptitle(title, fontsize=14)
    try:
        x = searchDict.values()
        labels = searchDict.keys()
        ax.pie(x, labels=labels);
    except 	ValueError:
        pass
    canvas = FigureCanvas(fig)
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response
开发者ID:huzichunjohn,项目名称:PyCon2012_Talk,代码行数:27,代码来源:views.py

示例5: TestDialog

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
class TestDialog( QDialog, Ui_dlgMPLTest ):
    def __init__( self, parent = None ):
        super( TestDialog, self ).__init__( parent )
        self.setupUi( self )
        
        # initialize mpl plot
        self.figure = Figure()
        #self.figure.set_figsize_inches( ( 4.3, 4.2 ) )
        self.axes = self.figure.add_subplot( 111 )
        self.figure.suptitle( "Frequency distribution", fontsize = 12 )
        self.axes.grid( True )
        self.canvas = FigureCanvas( self.figure )
        
        layout = QVBoxLayout()
        self.widgetPlot.setLayout(layout)
        layout.addWidget(self.canvas)
        #self.canvas.setParent( self.widgetPlot )
        
        # draw mpl plot
        #self.axes.clear()
        #self.axes.grid( True )
        #self.figure.suptitle( "Frequency distribution", fontsize = 12 )
        self.axes.set_ylabel( "Count", fontsize = 8 )
        self.axes.set_xlabel( "Values", fontsize = 8 )
        x = [ 4, 1, 5, 3, 3, 2, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1 ]
        n, bins, pathes = self.axes.hist( x, 18, alpha=0.5, histtype = "bar" )
        self.canvas.draw()
        
        self.setWindowTitle( self.tr( "MPL test" ) )
开发者ID:imanmirzaie,项目名称:qttests,代码行数:31,代码来源:tt4.py

示例6: plot_DVARS

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def plot_DVARS(title, DVARS_file, mean_DVARS_distribution=None, figsize=(11.7,8.3)):

    DVARS = np.loadtxt(DVARS_file)

    fig = Figure(figsize=figsize)
    FigureCanvas(fig)
    
    if mean_DVARS_distribution:
        grid = GridSpec(2, 4)
    else:
        grid = GridSpec(1, 4)
    
    ax = fig.add_subplot(grid[0,:-1])
    ax.plot(DVARS)
    ax.set_xlim((0, len(DVARS)))
    ax.set_ylabel("DVARS")
    ax.set_xlabel("Frame number")
    ylim = ax.get_ylim()
    
    ax = fig.add_subplot(grid[0,-1])
    sns.distplot(DVARS, vertical=True, ax=ax)
    ax.set_ylim(ylim)
    
    if mean_DVARS_distribution:
        ax = fig.add_subplot(grid[1,:])
        sns.distplot(mean_DVARS_distribution, ax=ax)
        ax.set_xlabel("Mean DVARS (over all subjects) [std]")
        MeanFD = DVARS.mean()
        label = "Mean DVARS = %g"%MeanFD
        plot_vline(MeanFD, label, ax=ax)
        
    fig.suptitle(title, fontsize='14')
        
    return fig
开发者ID:BmBaczkowski,项目名称:projectone,代码行数:36,代码来源:qc_utils_ext.py

示例7: plot_frame_displacement

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def plot_frame_displacement(FD_file, mean_FD_distribution=None, figsize=(11.7,8.3)):

    FD_power = np.loadtxt(FD_file)

    fig = Figure(figsize=figsize)
    FigureCanvas(fig)
    
    if mean_FD_distribution:
        grid = GridSpec(2, 4)
    else:
        grid = GridSpec(1, 4)
    
    ax = fig.add_subplot(grid[0,:-1])
    ax.plot(FD_power)
    ax.set_xlim((0, len(FD_power)))
    ax.set_ylabel("Frame Displacement [mm]")
    ax.set_xlabel("Frame number")
    ylim = ax.get_ylim()
    
    ax = fig.add_subplot(grid[0,-1])
    sns.distplot(FD_power, vertical=True, ax=ax)
    ax.set_ylim(ylim)
    
    if mean_FD_distribution:
        ax = fig.add_subplot(grid[1,:])
        sns.distplot(mean_FD_distribution, ax=ax)
        ax.set_xlabel("Mean Frame Displacement (over all subjects) [mm]")
        MeanFD = FD_power.mean()
        label = "MeanFD = %g"%MeanFD
        plot_vline(MeanFD, label, ax=ax)
        
    fig.suptitle('motion', fontsize='14')
        
    return fig
开发者ID:BmBaczkowski,项目名称:projectone,代码行数:36,代码来源:qc_utils_ext.py

示例8: plotSolarRadiationAgainstMonth

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def plotSolarRadiationAgainstMonth(filename):
    trainRowReader = csv.reader(open(filename, 'rb'), delimiter=',')
    month_most_common_list = []
    Solar_radiation_64_list = []
    for row in trainRowReader:
        month_most_common = row[3]
        Solar_radiation_64 = row[6]
        month_most_common_list.append(month_most_common)
        Solar_radiation_64_list.append(Solar_radiation_64)   
     
    #convert all elements in the list to float while skipping the first element for the 1st element is a description of the field.
    month_most_common_list = [float(i) for i in prepareList(month_most_common_list)[1:] ]
    Solar_radiation_64_list = [float(i) for i in prepareList(Solar_radiation_64_list)[1:] ]

    fig=Figure()
    ax=fig.add_subplot(111)
    title='Scatter Diagram of solar radiation against month of the year'
    ax.set_xlabel('Most common month')
    ax.set_ylabel('Solar Radiation')
    fig.suptitle(title, fontsize=14)
    try:
        ax.scatter(month_most_common_list, Solar_radiation_64_list)
        #it is possible to make other kind of plots e.g bar charts, pie charts, histogram
    except ValueError:
        pass
    canvas = FigureCanvas(fig)
    canvas.print_figure('solarRadMonth.png',dpi=500)
开发者ID:huzichunjohn,项目名称:PyCon2012_Talk,代码行数:29,代码来源:test.py

示例9: displayrankedItemwithBidsPieChart

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def displayrankedItemwithBidsPieChart(request):
    page_title='Pie Chart on Ranked Item'
    year=stat.getYear()
    itemBidDict, bidtotalSum = stat.createItemIDBidCountDict()
    top_ten_dict = stat.sortedItemDictionary(itemBidDict)
    itemobjDict = {}	
    for key,value in top_ten_dict:
        itemObj = get_object_or_404(Item, pk=key)
        itemobjDict[itemObj.name] = value

    fig=Figure()
    ax=fig.add_subplot(111)

    title='Top Ten ranked items with the highest bids ({0})'.format(year)
    fig.suptitle(title, fontsize=14)
    try:
        x = itemobjDict.values()
        labels = itemobjDict.keys()
        ax.pie(x, labels=labels);
    except ValueError:
        pass
    canvas = FigureCanvas(fig)
    response = HttpResponse(content_type='image/png')
    canvas.print_png(response)
    return response
开发者ID:huzichunjohn,项目名称:PyCon2012_Talk,代码行数:27,代码来源:views.py

示例10: processOne

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def processOne(fn,done,gpus,telescope,outdir,plotdir,redo=False):
    print fn
    info = decodeFilename(fn)
    print info
    pklname = ('ds_%s_%s_%s_%s.pkl' % (info['source'],info['mjd'],
                                      info['scan'],telescope))
    outfn = os.path.join(outdir,'pkls',pklname)
    if (not redo) and (outfn in done):
        return fn,None,pklname
    try:
    #if True:
        ds = loadDynSpecFromCycSpecScan(int(info['scan']), int(info['mjd']), 
                                        gpus=gpus, telescope=telescope)
        print "loaded dynspec"
        dynspec.pickle(outfn, ds)
        print "pickled",outfn
        fig = Figure(figsize=(10,12))
        fig.subplots_adjust(left=0.09,bottom=0.05,top=0.95,right=0.95)
        ds.plot(fig=fig)
        plotname = os.path.join(plotdir,pklname + '.png')
        esc_fname = outfn.replace('_',r'\_')
        fig.suptitle(('%s @ %s %s' % (info['source'],telescope,esc_fname)),size='medium')
        canvas = FigureCanvasAgg(fig)
        canvas.print_figure(plotname)
    except Exception,e:
        print fn,e,pklname
        return fn,e,pklname
开发者ID:gitj,项目名称:dynISM,代码行数:29,代码来源:cycspec.py

示例11: _setup_figure

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
 def _setup_figure(self, figure=None):
     """create figure if not supplied; apply the top-level formatting
     """
     attrs    = self.attrs
     if figure is None:
         figure = Figure() #use to create an object oriented only figure which can be gargbage collected
     suptitle = attrs['suptitle']
     if not suptitle is None:
         figure.suptitle(suptitle)
     return figure
开发者ID:cversek,项目名称:python-automat,代码行数:12,代码来源:plots.py

示例12: quality_control_plot

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def quality_control_plot(eid, experiment, plot_dir):
    print('starting quality controlplots')
    plt.style.use('bmh')
    print('set style to bmh')
    fig = Figure(figsize=(16, 10), dpi=100)
    canvas = FigureCanvas(fig)
    # fig = plt.figure(figsize=(16, 10), dpi=500)
    gs = grd.GridSpec(5, 8, wspace=1, hspace=1)

    step_top_ax = fig.add_subplot(gs[1:3, 0:4])
    step_bot_ax = fig.add_subplot(gs[3:5, 0:4])
    squiggle_ax = fig.add_subplot(gs[1:5, 4:8])


    # Set title
    title = '{eid}\n {name}'.format(eid=eid, name=experiment.basename)
    fig.suptitle(title, size=20)

    st = StepPlot(experiment=experiment)
    st.make_figures(ax2=step_top_ax, ax1=step_bot_ax)
    step_top_ax.text(2.9, 0.1, '5 < t < 40 min', fontsize=16,
                     verticalalignment='bottom', horizontalalignment='right',
                     )

    step_bot_ax.text(2.9, 0.1, 't > 40 min', fontsize=16,
                     verticalalignment='bottom', horizontalalignment='right',
                     )

    # Squiggle Plot!
    squiggle_plot(e=experiment, ax=squiggle_ax)

    for ax in [step_top_ax, step_bot_ax, squiggle_ax]:
        ax.set_axis_bgcolor('white')
        # print('fixing axes boarder')
        # ax.axis('on')
        # [i.set_linewidth(0.5) for i in ax.spines.itervalues()]
        # ax.patch.set_visible(True)
        # ax.spines['top'].set_visible(True)
        # ax.spines['right'].set_visible(True)
        # ax.spines['bottom'].set_visible(True)
        # ax.spines['left'].set_visible(True)
        draw_border(ax)

    gs.tight_layout(fig)

    path = pathlib.Path(plot_dir)
    if not path.is_dir():
        path.mkdir()
    name = path / '{eid}-check.png'.format(eid=eid)
    print('Saving figure as {}'.format(name)) 
    #fig.savefig(str(name))
    #plt.close(fig)
    canvas.print_png(str(name))
    print('End!')
开发者ID:amarallab,项目名称:waldo,代码行数:56,代码来源:quality_plots.py

示例13: MatplotlibWidget

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
class MatplotlibWidget(QWidget):
	def __init__(self,parent=None):
		super(MatplotlibWidget,self).__init__(parent)
		self.figure = Figure(figsize=(1,1))
		self.figure.subplots_adjust(left=0.2)
		self.canvas = FigureCanvasQTAgg(self.figure)
		self.axis = self.figure.add_subplot(111,xlim=(0,60),ylim=(0,20))
		self.axis.tick_params(axis='x',labelsize=8)
		self.axis.tick_params(axis='y',labelsize=8)
		self.layoutVertical = QVBoxLayout(self)
		self.layoutVertical.addWidget(self.canvas)
		self.figure.suptitle("Queue Length",fontsize=8)
开发者ID:jimdrie,项目名称:qtmarietje,代码行数:14,代码来源:qtmarietje.py

示例14: drawGraph

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def drawGraph(n, flag, endowments, prices, graphs):
    roundN = len(endowments)

    fig = Figure(figsize=[10, 10])
    fig.suptitle(flag)

    drawEP(fig, n, roundN, endowments, prices)
    drawG(fig, n, roundN, graphs)

    canvas = FigureCanvasAgg(fig)
    filePath = folder + "/" + flag + ".png"
    print 'log: ' + filePath
    canvas.print_figure( filePath )
开发者ID:iSuneast,项目名称:Market,代码行数:15,代码来源:makeLog.py

示例15: plot_2_distributions

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import suptitle [as 别名]
def plot_2_distributions(distribution1,  xlabel1, distribution2,  xlabel2, subject_value1=None, subject_value_label1='',
                           subject_value2=None, subject_value_label2='', title='', figsize=(8.3, 7)):

    fig = Figure(figsize=figsize)
    FigureCanvas(fig)

    gs = GridSpec(2, 1)
    ax = fig.add_subplot(gs[0, 0])
    plot_distribution_of_values(ax, distribution1, xlabel1, subject_value=subject_value1, subject_value_label=subject_value_label1)
    ax = fig.add_subplot(gs[1, 0])
    plot_distribution_of_values(ax, distribution2, xlabel2, subject_value=subject_value2, subject_value_label=subject_value_label2)
    fig.suptitle(title)
    return fig
开发者ID:NeuroanatomyAndConnectivity,项目名称:LeiCA,代码行数:15,代码来源:qc_plots.py


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