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


Python pyplot.suptitle函数代码示例

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


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

示例1: plot_single_output_multiple_days

    def plot_single_output_multiple_days(self, single_output, days_list=SOLSTICES, title_str=''):
        # Output: graph with subplots for each day
        # Inputs: df_dict: dict of dataframes of PVsyst result
        #        single_output: keyword name of data to plot
        #        days_list: list of datetimes as strings in format %Y-%m-%d; used for subplots' titles
        single_output_df = self.get_single_output_df(single_output)
        legend_list = list(single_output_df.columns)
        y_info = get_y_axis_info(single_output)
        plt.figure(figsize=(8, 15))
        plt.suptitle(self.location + ': ' + single_output + '\n' + title_str, fontsize=16)

        ax = []
        for d in range(1, len(days_list) + 1):
            if d == 1:
                ax.append(plt.subplot(len(days_list), 1, d))
                plt.ylabel(y_info[UNITS], fontsize=14)
            else:
                ax.append(plt.subplot(len(days_list), 1, d, sharex=ax[0], sharey=ax[0]))
            plt.grid(True, which='major', axis='x')
            ax[d - 1].plot(single_output_df[days_list[d - 1]].index.hour, single_output_df[days_list[d - 1]]/y_info[SCALE],
                           marker='.')
            # if show_flat == True:
            #     ax[d - 1].plot(flat_df[days_list[d - 1]].index.hour, flat_df[days_list[d - 1]], 'k--')
            ax[d - 1].legend(legend_list, loc='lower right', fontsize=9)
            ax[d - 1].set_title(days_list[d - 1], fontsize=12)

        plt.xlabel('Hour of day', fontsize=14)
        ax[0].set_xlim([0, 24])
        ax[0].set_xticks([0, 6, 12, 18, 24])
        ax[0].set_ylim(y_info[LIM])
开发者ID:cliebner,项目名称:PVresearch,代码行数:30,代码来源:pvsyst_sims2.py

示例2: plotPSD

	def plotPSD(self, chan, time_interval):
		Npackets = np.int(time_interval * self.accum_freq)
		plot_range = (Npackets / 2) + 1
		figure = plt.figure(num= None, figsize=(12,12), dpi=80, facecolor='w', edgecolor='w')
		# I 
		plt.suptitle('Channel ' + str(chan) + ' , Freq = ' + str((self.freqs[chan] + self.LO_freq)/1.0e6) + ' MHz') 
		plot1 = figure.add_subplot(311)
		plot1.set_xscale('log')
		plot1.set_autoscale_on(True)
		plt.ylim((-160,-80))
		plt.title('I')
		line1, = plot1.plot(np.linspace(0, self.accum_freq/2., (Npackets/2) + 1), np.zeros(plot_range), label = 'I', color = 'green', linewidth = 1)
		plt.grid()
		# Q
		plot2 = figure.add_subplot(312)
		plot2.set_xscale('log')
		plot2.set_autoscale_on(True)
		plt.ylim((-160,-80))
		plt.title('Q')
		line2, = plot2.plot(np.linspace(0, self.accum_freq/2., (Npackets/2) + 1), np.zeros(plot_range), label = 'Q', color = 'red', linewidth = 1)
		plt.grid()
		# Phase
		plot3 = figure.add_subplot(313)
		plot3.set_xscale('log')
		plot3.set_autoscale_on(True)
		plt.ylim((-120,-70))
		#plt.xlim((0.0001, self.accum_freq/2.))
		plt.title('Phase')
		plt.ylabel('dBc rad^2/Hz')
		plt.xlabel('log Hz')
		line3, = plot3.plot(np.linspace(0, self.accum_freq/2., (Npackets/2) + 1), np.zeros(plot_range), label = 'Phase', color = 'black', linewidth = 1)
		plt.grid()
		plt.show(block = False)
		count = 0
		stop = 1.0e10
		while count < stop:
			Is, Qs, phases = self.get_stream(chan, time_interval)
			I_mags = np.fft.rfft(Is, Npackets)
			Q_mags = np.fft.rfft(Is, Npackets)
			phase_mags = np.fft.rfft(phases, Npackets)
			I_vals = (np.abs(I_mags)**2 * ((1./self.accum_freq)**2 / (1.0*time_interval)))
			Q_vals = (np.abs(Q_mags)**2 * ((1./self.accum_freq)**2 / (1.0*time_interval)))
			phase_vals = (np.abs(phase_mags)**2 * ((1./self.accum_freq)**2 / (1.0*time_interval)))
			phase_vals = 10*np.log10(phase_vals)
			phase_vals -= phase_vals[0]
			#line1.set_ydata(Is)
			#line2.set_ydata(Qs)
			#line3.set_ydata(phases)
			line1.set_ydata(10*np.log10(I_vals))
			line2.set_ydata(10*np.log10(Q_vals))
			line3.set_ydata(phase_vals)
			plot1.relim()
			plot1.autoscale_view(True,True,False)
			plot2.relim()
			plot2.autoscale_view(True,True,False)
			#plot3.relim()
			plot3.autoscale_view(True,True,False)
			plt.draw()
			count +=1
		return
开发者ID:braddober,项目名称:blastfirmware,代码行数:60,代码来源:blastfirmware_dirfile.py

示例3: scatter_time_vs_s

def scatter_time_vs_s(time, norm, point_labels, title):
    plt.figure()
    size = 100
    for i, l in enumerate(sorted(norm.keys())):
        if l is not "fbpca":
            plt.scatter(time[l], norm[l], label=l, marker='o', c='b', s=size)
            for label, x, y in zip(point_labels, list(time[l]), list(norm[l])):
                plt.annotate(label, xy=(x, y), xytext=(0, -80),
                             textcoords='offset points', ha='right',
                             arrowprops=dict(arrowstyle="->",
                                             connectionstyle="arc3"),
                             va='bottom', size=11, rotation=90)
        else:
            plt.scatter(time[l], norm[l], label=l, marker='^', c='red', s=size)
            for label, x, y in zip(point_labels, list(time[l]), list(norm[l])):
                plt.annotate(label, xy=(x, y), xytext=(0, 30),
                             textcoords='offset points', ha='right',
                             arrowprops=dict(arrowstyle="->",
                                             connectionstyle="arc3"),
                             va='bottom', size=11, rotation=90)

    plt.legend(loc="best")
    plt.suptitle(title)
    plt.ylabel("norm discrepancy")
    plt.xlabel("running time [s]")
开发者ID:0664j35t3r,项目名称:scikit-learn,代码行数:25,代码来源:bench_plot_randomized_svd.py

示例4: display_channel_efficiency

    def display_channel_efficiency(self):

        size = 0

        start_time = self.pcap_file[0].time
        end_time = self.pcap_file[len(self.pcap_file) - 1].time

        duration = (end_time - start_time)/1000

        for i in range(len(self.pcap_file) - 1):
            size += len(self.pcap_file[i])
        ans = (((size * 8) / duration) / BW_STANDARD_WIFI) * 100
        ans = float("%.2f" % ans)
        labels = ['utilized', 'unutilized']
        sizes = [ans, 100.0 - ans]
        colors = ['g', 'r']

        # Make a pie graph
        plt.clf()
        plt.figure(num=1, figsize=(8, 6))
        plt.axes(aspect=1)
        plt.suptitle('Channel efficiency', fontsize=14, fontweight='bold')
        plt.title("Bits/s: " + str(float("%.2f" % ((size*8)/duration))),fontsize = 12)
        plt.rcParams.update({'font.size': 17})
        plt.pie(sizes, labels=labels, autopct='%.2f%%', startangle=60, colors=colors, pctdistance=0.7, labeldistance=1.2)

        plt.show()
开发者ID:yarongoldshtein,项目名称:Wifi_Parser,代码行数:27,代码来源:ex3.py

示例5: display_graph_by_specific_mac

    def display_graph_by_specific_mac(self, mac_address):

        G = nx.Graph()

        count = 0
        edges = set()
        edges_list = []


        for pkt in self.pcap_file:

            src = pkt[Dot11].addr1
            dst = pkt[Dot11].addr2

            if mac_address in [src, dst]:
                edges_list.append((src, dst))
                edges.add(src)
                edges.add(dst)

        plt.clf()
        plt.suptitle('Communicating with ' + str(mac_address), fontsize=14, fontweight='bold')
        plt.title("\n Number of Communicating Users: " + str(int(len(edges))))
        plt.rcParams.update({'font.size': 10})
        G.add_edges_from(edges_list)
        nx.draw(G, with_labels=True, node_color=MY_COLORS)
        plt.show()
开发者ID:yarongoldshtein,项目名称:Wifi_Parser,代码行数:26,代码来源:ex3.py

示例6: run_div_test

def run_div_test(fld, exact, title='', show=False, ignore_inexact=False):
    t0 = time()
    result_numexpr = viscid.div(fld, preferred="numexpr", only=False)
    t1 = time()
    logger.info("numexpr magnitude runtime: %g", t1 - t0)

    result_diff = viscid.diff(result_numexpr, exact)['x=1:-1, y=1:-1, z=1:-1']
    if not ignore_inexact and not (result_diff.data < 5e-5).all():
        logger.warning("numexpr result is far from the exact result")
    logger.info("min/max(abs(numexpr - exact)): %g / %g",
                np.min(result_diff.data), np.max(result_diff.data))

    planes = ["y=0j", "z=0j"]
    nrows = 2
    ncols = len(planes)
    _, axes = plt.subplots(nrows, ncols, squeeze=False)

    for i, p in enumerate(planes):
        vlt.plot(result_numexpr, p, ax=axes[0, i], show=False)
        vlt.plot(result_diff, p, ax=axes[1, i], show=False)

    plt.suptitle(title)
    vlt.auto_adjust_subplots(subplot_params=dict(top=0.9))

    plt.savefig(next_plot_fname(__file__))
    if show:
        vlt.mplshow()
开发者ID:KristoforMaynard,项目名称:Viscid,代码行数:27,代码来源:test_div.py

示例7: template_matching

def template_matching():
    img = cv2.imread('messi.jpg',0)
    img2 = img.copy()
    template = cv2.imread('face.png',0)
    w, h = template.shape[::-1]

    # All the 6 methods for comparison in a list
    methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR',
            'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', 'cv2.TM_SQDIFF_NORMED']

    for meth in methods:
        img = img2.copy()
        method = eval(meth)

        # Apply template Matching
        res = cv2.matchTemplate(img,template,method)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)

        # If the method is TM_SQDIFF or TM_SQDIFF_NORMED, take minimum
        if method in [cv2.TM_SQDIFF, cv2.TM_SQDIFF_NORMED]:
            top_left = min_loc
        else:
            top_left = max_loc
        bottom_right = (top_left[0] + w, top_left[1] + h)

        cv2.rectangle(img,top_left, bottom_right, 255, 2)

        plt.subplot(121),plt.imshow(res,cmap = 'gray')
        plt.title('Matching Result'), plt.xticks([]), plt.yticks([])
        plt.subplot(122),plt.imshow(img,cmap = 'gray')
        plt.title('Detected Point'), plt.xticks([]), plt.yticks([])
        plt.suptitle(meth)

        plt.show()
开发者ID:JamesPei,项目名称:PythonProjects,代码行数:34,代码来源:TemplateMatching.py

示例8: generate_line_chart

    def generate_line_chart(self, data, node_type, field, append_table=True):
        output = []
        common.bash("mkdir -p ../visualizer/include/pic")
        common.bash("mkdir -p ../visualizer/include/csv")
        common.printout("LOG","generate %s line chart" % node_type)
        for field_column, field_data in data.items():
            pyplot.figure(figsize=(9, 4))
            for node, node_data in field_data.items():
                pyplot.plot(node_data, label=node)
            pyplot.xlabel("time(sec)")
            pyplot.ylabel("%s" % field_column)
            # Shrink current axis's height by 10% on the bottom
            pyplot.legend(loc = 'center left', bbox_to_anchor = (1, 0.5), prop={'size':6})
            pyplot.grid(True)
            pyplot.suptitle("%s" % field_column)
            pic_name = '%s_%s_%s.png' % (node_type, field, re.sub('[/%]','',field_column))
            pyplot.savefig('../visualizer/include/pic/%s' % pic_name) 
            pyplot.close()
            line_table = []
            csv = self.generate_csv_from_json(field_data,'line_table',field_column)
            csv_name = '%s_%s_%s.csv' % (node_type, field, re.sub('[/%]','',field_column))
            with open( '../visualizer/include/csv/%s' % csv_name, 'w' ) as f:
                f.write( csv )
#output.append("<div class='cetune_pic' id='%s_%s_pic'><button><a href='./include/csv/%s'>Download detail csv table</a></button><img src='./include/pic/%s' alt='%s' style='height:400px; width:1000px'></div>" % (field, re.sub('[/%]','',field_column), csv_name, pic_name, field_column))
            output.append("<div class='cetune_pic' id='%s_%s_pic'><img src='./include/pic/%s' alt='%s' style='height:400px; width:1000px'><button><a href='./include/csv/%s'>Download detail csv table</a></button></div>" % (field, re.sub('[/%]','',field_column), pic_name, field_column, csv_name))
        return output
开发者ID:eval-printer,项目名称:CeTune,代码行数:26,代码来源:visualizer.py

示例9: run_mag_test

def run_mag_test(fld, title="", show=False):
    vx, vy, vz = fld.component_views()  # pylint: disable=W0612
    vx, vy, vz = fld.component_fields()

    try:
        t0 = time()
        mag_ne = viscid.magnitude(fld, preferred="numexpr", only=False)
        t1 = time()
        logger.info("numexpr mag runtime: %g", t1 - t0)
    except viscid.verror.BackendNotFound:
        xfail("Numexpr is not installed")

    planes = ["z=0", "y=0"]
    nrows = 4
    ncols = len(planes)

    _, axes = plt.subplots(nrows, ncols, sharex=True, sharey=True, squeeze=False)

    for ind, p in enumerate(planes):
        vlt.plot(vx, p, ax=axes[0, ind], show=False)
        vlt.plot(vy, p, ax=axes[1, ind], show=False)
        vlt.plot(vz, p, ax=axes[2, ind], show=False)
        vlt.plot(mag_ne, p, ax=axes[3, ind], show=False)

    plt.suptitle(title)
    vlt.auto_adjust_subplots(subplot_params=dict(top=0.9, right=0.9))
    plt.gcf().set_size_inches(6, 7)

    plt.savefig(next_plot_fname(__file__))
    if show:
        vlt.mplshow()
开发者ID:KristoforMaynard,项目名称:Viscid,代码行数:31,代码来源:test_calc.py

示例10: localisationFault

def localisationFault():
    # read file
    faults = []
    for line in f1:
        line = line.split('\t')
        lst = [float(x) for x in line]
        faults.append(lst)
    
    # extract
    xFault = list(map(lambda l : l[0], faults))
    yFault = list(map(lambda l : l[1], faults))
    thetaFault = list(map(lambda l : l[2], faults))
    
    # number of items
    num = len(xFault) + 1
    time = list(range(1, num))
    
    plt.suptitle('Robot localisation fault', fontsize=20)
    # plot
    plt.plot(time, xFault, 'r', label='x fault')
    plt.plot(time, yFault, 'b', label='y fault')
    plt.plot(time, thetaFault, 'y', label='theta fault')
    plt.legend(numpoints=3)
    # xMin - xMax and yMin - yMax
    plt.axis([0, num, 0, 1.2])
    plt.show()
开发者ID:bestehle,项目名称:RobotSimulator,代码行数:26,代码来源:Charts.py

示例11: boxPositions

def boxPositions():
    positons = []
    f2 = open(Stats.BOX_POSITIONS_FILE)
    for line in f2:
        line = line.split('\t')
        lst = [float(x) for x in line]
        positons.append(lst)
        
    approX = list(map(lambda l : l[0], positons))
    approY = list(map(lambda l : l[1], positons))
    trueX = list(map(lambda l : l[2], positons))
    trueY = list(map(lambda l : l[3], positons))
    
    # number of items
    num = len(approX) + 1
    time = list(range(1, num))
    
    plt.suptitle('Box positions', fontsize=20)
    # plot
    plt.subplot(211)
    plt.ylabel('x', fontsize=18)
    plt.plot(time, approX, 'r', label='Approximate Position')
    plt.plot(time, trueX, 'g', label='True Position')
    plt.legend(numpoints=1)
    plt.subplot(212)
    plt.ylabel('y', fontsize=18)
    plt.plot(time, approY, 'r')
    plt.plot(time, trueY, 'g')

    plt.show()
开发者ID:bestehle,项目名称:RobotSimulator,代码行数:30,代码来源:Charts.py

示例12: _drawTitle

 def _drawTitle(self,isContour=False):
     #Add a title
     hlon = self.shakemap.getEventDict()['lon']
     hlat = self.shakemap.getEventDict()['lat']
     edict = self.shakemap.getEventDict()
     eloc = edict['event_description']
     timestr = edict['event_timestamp'].strftime('%b %d, %Y %H:%M:%S')
     mag = edict['magnitude']
     if hlon < 0:
         lonstr = 'W%.2f' % np.abs(hlon)
     else:
         lonstr = 'E%.2f' % hlon
     if hlat < 0:
         latstr = 'S%.2f' % np.abs(hlat)
     else:
         latstr = 'N%.2f' % hlat
     dep = edict['depth']
     eid = edict['event_id']
     net = edict['event_network']
     if not eid.startswith(net):
         eid = net + eid
     tpl = (timestr,mag,latstr,lonstr,dep,eid)
     layername = 'MMI'
     if isContour:
         layername = self.contour_layer.upper()
     plt.suptitle('USGS ShakeMap (%s): %s' % (layername,eloc),fontsize=14,verticalalignment='top',y=0.95)
     plt.title('%s UTC M%.1f %s %s Depth: %.1fkm ID:%s' % tpl,fontsize=10,verticalalignment='bottom')
     return eid
开发者ID:klin-usgs,项目名称:shakemap,代码行数:28,代码来源:mapmaker.py

示例13: plot_marginals

def plot_marginals(state_space,p,D,name,rank,t,to_file = False):
	import matplotlib
	#matplotlib.use("PDF")
	#matplotlib.rcParams['figure.figsize'] = 5,10
	import matplotlib.pyplot as pl
	pl.suptitle("time: "+ str(t)+" units")
	print("time : "+ str(t))
	for i in range(D):
		marg_X = np.unique(state_space[:,i])
		A = np.where(marg_X[:,np.newaxis] == state_space[:,i].T[np.newaxis,:],1,0)
		marg_p = np.dot(A,p)
		pl.subplot(int(D/2)+1,2,i+1)
		pl.plot(marg_X,marg_p)
		if to_file == True:
			string_state = str(t) 
			string_prob = str(t) 
			f = open("Visuals/cummulative_state_"+ str(i)+".txt",'a')
			g = open("Visuals/cummulative_prob_"+ str(i)+".txt",'a')
			for j in range(len(marg_X)):
				string_state +=','+ str(marg_X[j])
				string_prob += ','+ str(marg_p[j])
			string_state += '\n'
			string_prob += '\n'
			f.write(string_state)
			g.write(string_prob)
			f.close()
			g.close()	
	 

	pl.savefig("Visuals/marginal_"+name+".pdf",format='pdf')
	pl.show()
	pl.clf()
开发者ID:SysSynBio,项目名称:PyME,代码行数:32,代码来源:util_FSP.py

示例14: compare_single_output_across_batches

def compare_single_output_across_batches(batches_list, variants_list, params_list, single_output, days_list=SOLSTICES):
    # ORDER MATTERS for batches_list, variants_list, and params_list!!
    # e.g. this method will compare the param[i] of variant[i] of the batch[i] with
    # the param[i+1] of variant[i+1] of batch[i+1], etc.
    results_df_list = []
    legend_list = []
    for b in range(len(batches_list)):
        results_df_list.append(batches_list[b].results_dict.get(variants_list[b]))
        # legend_list.append(batches_list[b].location[:11] +
        #                    str(batches_list[b].variant_output_map[variants_list[b]]) +
        #                    batches_list[b].output_name)

    plt.figure(figsize=(8, 15))
    plt.suptitle(single_output, fontsize=16)
    y_info = get_y_axis_info(single_output)

    ax = []
    for d in range(1, len(days_list) + 1):
        if d == 1:
            ax.append(plt.subplot(len(days_list), 1, d))
            plt.ylabel(y_info[UNITS], fontsize=14)
        else:
            ax.append(plt.subplot(len(days_list), 1, d, sharex=ax[0], sharey=ax[0]))
        plt.grid(True, which='major', axis='x')
        [ax[d - 1].plot(r[days_list[d - 1]].index.hour, r.loc[days_list[d - 1], single_output]/y_info[SCALE])
         for r in results_df_list]
        ax[d - 1].set_title(days_list[d - 1], fontsize=12)

    plt.xlabel('Hour of day', fontsize=14)
    ax[0].set_xlim([0, 24])
    ax[0].set_xticks([0, 6, 12, 18, 24])
    ax[0].set_ylim(y_info[LIM])
    ax[0].legend(params_list, loc='lower right', fontsize=9)
开发者ID:cliebner,项目名称:PVresearch,代码行数:33,代码来源:pvsyst_sims2.py

示例15: boxplotThem

def boxplotThem(dataToPlot,title):
    means = [np.mean(item) for item in dataToPlot]
    fig = plt.figure(1, figsize=(9,6))
    ax = fig.add_subplot(111)

    plt.rc('text', usetex=True)
    plt.rc('font', family='serif')
    for i in range(25):
        print('length ',str(i+1))
        for item in dataToPlot[i]:
            ax.scatter(i+1,item)

    ax.plot(list(range(1,26)),means,linewidth=4,color='r')

    ax.set_xticks([1,5,10,15,20,25])
    ax.set_xticklabels([r"$1",r"$5$",r"$10$",r"$15$",r"$20$",r"$25$"],fontsize = 25)

    ax.set_yscale('log')
    ax.set_yticks([0.00000001,0.000001,0.0001,0.01,1])
    ax.xaxis.set_tick_params(width=1.5)
    ax.yaxis.set_tick_params(width=1.5)
    ax.set_yticklabels([r"$10^{-8}$",r"$10^{-6}$",r"$10^{-4}$",r"$10^{-2}$",r"$1$"],fontsize = 25)
    ax.get_yaxis().get_major_formatter().labelOnlyBase = False
    ax.set_ylabel('relative population',fontsize = 30)
    ax.set_xlabel(r'length',fontsize = 30)
    ax.set_xlim(0,26)
    ax.set_ylim(0.00000005)
    plt.suptitle(title,fontsize=25)
    plt.savefig(r.outputDir+'distr.png')
开发者ID:gelisa,项目名称:pdmmod,代码行数:29,代码来源:analyzeTraj.py


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