• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyplot.figlegend函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: scatter_plot_matrix

def scatter_plot_matrix(data,class_labels,filename):
    plt.figure(figsize=(2000/96, 2000/96), dpi=96)
    for i in range(0,5):
        plt.subplot(5,5,5*i+i+1)
        plt.title(str(data.columns[i]), fontsize=10)
        min_value = float(np.min(data.ix[:,i]))
        max_value = float(np.max(data.ix[:,i]))
        xs = np.linspace(min_value,max_value,500) 
        k=0
        for cl in class_list:
            ind = np.where(class_labels == cl)[0]
            plot_density(data.ix[ind,i],xs,col[k])
            k+=1
        k=0
        for j in range(0,5):
            if i!=j:
                plt.subplot(5,5,5*i+j+1)
                plt.title(str(data.columns[i]) + " vs " + str(data.columns[j]), fontsize=10)
                plt.xlabel(data.columns[i], fontsize=10)
                plt.ylabel(data.columns[j], fontsize=10)
                for k in range(0,4):
                    ind = np.where(class_labels == class_list[k])[0]
                    plt.scatter(data.ix[ind,i],data.ix[ind,j],s=10,color = col[k],marker = marker_style[k], facecolors = 'none')
    line=[]
    for i in range(0,4):
        line.append(mlines.Line2D([], [], color=col[i], marker=marker_style[i],markersize=10))
    plt.tight_layout()
    plt.figlegend(handles = line, labels = class_list, loc = "upper right")
    plt.savefig(filename)
    plt.show() #refer to the saved image for proper visualization
开发者ID:mnshgl0110,项目名称:Bioinformatics2,代码行数:30,代码来源:task4.py


示例2: plot

def plot(labels, real_values, *values_list):
    values = list(values_list)
    one_step_ahead = []
    one_step_ahead.append(real_values)
    k_step_ahead = []
    k_step_ahead.append(real_values)
    for i in range(0, len(values)/2):
        one_step_ahead.append(values[i])
        k_step_ahead.append(values[len(values)/2 + i])
    observations = []
    for i in np.arange(1, len(real_values) + 1):
        observations.append(i)
    plt.subplot(211)
    plt.grid(True)
    plt.xlabel('observations')
    plt.ylabel('temperature (C)')
    plt.title('One-step-ahead Data Prediction')
    plt.ylim(0, 31)
    lines = []
    for lab, val in zip(labels, one_step_ahead):
        lines.extend(plt.plot(observations, val, label=lab))
    plt.subplot(212)
    plt.grid(True)
    plt.xlabel('observations')
    plt.ylabel('temperature (C)')
    plt.title('K-step-ahead Data Prediction')
    plt.ylim(0, 31)
    for lab, val in zip(labels, k_step_ahead):
        plt.plot(observations, val, label=lab)
    plt.figlegend(lines, labels, loc = 'lower center', ncol=len(labels), labelspacing=0.)
    plt.show()
开发者ID:AleDanish,项目名称:regression,代码行数:31,代码来源:utils.py


示例3: overlay_raw_data

def overlay_raw_data(raw_dict, individual_raw_dict, mole_graph, individual_graph, sun_results, uuid, out_path):
    # used because the SUN model uses single letter labels
    para_map = {"Notch2NL-A": "A", "Notch2NL-B": "B", "Notch2NL-C": "C", "Notch2NL-D": "D", "Notch2": "N"}
    fig, plots = plt.subplots(len(mole_graph.paralogs), sharey=True, figsize=(12.0, 5.0))
    individual_patch = matplotlib.patches.Patch(color=color_palette[0], fill="true")
    mole_patch = matplotlib.patches.Patch(color=color_palette[1], fill="true")
    plt.figlegend((individual_patch, mole_patch), ("Individual", "Mole"), loc='upper right', ncol=2)
    max_gap = max(stop - start for start, stop in mole_graph.paralogs.itervalues())
    for i, (p, para) in enumerate(izip(plots, mole_graph.paralogs.iterkeys())):
        start, stop = mole_graph.paralogs[para]
        rounded_max_gap = int(math.ceil(1.0 * max_gap / 10000) * 10000)
        p.axis([start, start + rounded_max_gap, 0, 4])
        x_ticks = [start] + range(start + 20000, start + rounded_max_gap + 20000, 20000)
        p.axes.set_yticks(range(5))
        p.axes.set_yticklabels(map(str, range(5)), fontsize=9)
        p.axes.set_xticks(x_ticks)
        p.axes.set_xticklabels(["{:.3e}".format(start)] + [str(20000 * x) for x in xrange(1, len(x_ticks))])
        starts, stops, vals = zip(*raw_dict[para])
        p.hlines(vals, starts, stops, color=color_palette[1], alpha=0.8, linewidth=2.0)
        if len(sun_results[para_map[para]]) > 0:
            sun_pos, sun_vals = zip(*sun_results[para_map[para]])
            p.vlines(np.asarray(sun_pos), np.zeros(len(sun_pos)), sun_vals, color="#E83535", linewidth=0.5, alpha=0.5)
        for x in range(1, 4):
            p.axhline(y=x, ls="--", lw=0.5)
        p.set_title("{}".format(para))
    for i, (p, para) in enumerate(izip(plots, individual_graph.paralogs.iterkeys())):
        starts, stops, vals = zip(*individual_raw_dict[para])
        p.hlines(vals, starts, stops, color=color_palette[0], alpha=0.8, linewidth=2.0)
        p.set_title("{}".format(para))    
    fig.subplots_adjust(hspace=0.8)
    plt.savefig(out_path, format="png", dpi=500)
    plt.close()
开发者ID:ifiddes,项目名称:notch2nl_CNV,代码行数:32,代码来源:overlay_raw_data_v2.py


示例4: compare_hr_run

def compare_hr_run(filename1, filename2, descriptor1='1st HR',
                   descriptor2='2nd HR', verbose=False):
  """
  Method to generate a plot comparison between two gpx runs
  """
  import matplotlib.pyplot as plt
  run1 = GPXCardio(filename1, verbose)
  run2 = GPXCardio(filename2, verbose)
  cardio1 = run1.getCardio()
  cardio2 = run2.getCardio()

  # Assume 1st file goes first in time
  def pts_fun(it, hr):
    t = map(lambda x: (x[0] - it).seconds, hr)
    hr = map(lambda x: x[1], hr)
    return t, hr

  initial_time = cardio1[0][0]
  f1_time, f1_hr = pts_fun(initial_time, cardio1)
  f2_time, f2_hr = pts_fun(initial_time, cardio2)
  lines = plt.plot(f1_time, f1_hr, 'r', f2_time, f2_hr, 'b')
  plt.ylabel("Heart Rate [bpm]")
  plt.xlabel("Seconds from begining")
  plt.title("Heart Rate Monitor Comparison")
  plt.grid(True)
  plt.figlegend((lines), (descriptor1, descriptor2), 'lower right')

  plt.show()
开发者ID:javiere,项目名称:GPXCardio,代码行数:28,代码来源:GPXCardio.py


示例5: percplot

def percplot(data, perclist, file_name='weight_update_percentile', file_extension='.png', save_im=True, disp_im=False,
             sety=True):
    """Plot percentiles of weight update information during 'training1' of RBM object (RBM_m.py)

    :param data: list of lists, each sublist containing the same percentiles of the weight update matrices
    :param perclist: list of used percentiles
    :param file_name: name of optional output file (default: 'weight_update_percentile')
    :param file_extension: extension of optional output file (default: '.png')
    :param save_im: whether to save image (default: True)
    :param disp_im: whether to show image (default: False)
    :param sety: whether to set the y-range to predefined limits (default: True)
    :return: nothing, displays plot or saves plot to output file
    """

    fig = plt.figure()
    lines = plt.plot(data)
    plt.ylabel('update / weight')
    plt.xlabel('batch number')

    if sety:
        plt.ylim([-0.1, 0.1])

    plt.figlegend(lines, perclist, 'upper right')

    if disp_im:
        plt.show()

    if save_im:
        # Save to (.png) file, remove white border
        plt.savefig("{}{}".format(file_name, file_extension), bbox_inches='tight')

    plt.close(fig)                  # Clear current figure
开发者ID:Willemijn42,项目名称:RBM-numerosity,代码行数:32,代码来源:loose_fun_an.py


示例6: med_spread_plot

def med_spread_plot(data, obj_names, fig_name="temp.png", **settings):
  fig = plt.figure(1)
  fig.subplots_adjust(hspace=0.5)
  directory = fig_name.rsplit("/", 1)[0]
  mkdir(directory)
  for i, data_map in enumerate(data):
    meds = data_map["meds"]
    iqrs = data_map.get("iqrs", None)
    if iqrs:
      x = range(len(meds))
      index = int(str(len(data))+"1"+str(i+1))
      plt.subplot(index)
      plt.title(obj_names[i])
      plt.plot(x, meds, 'b-', x, iqrs, 'r-')
      plt.ylim((min(iqrs)-1, max(meds)+1))
    else:
      x = range(len(meds))
      index = int(str(len(data))+"1"+str(i+1))
      plt.subplot(index)
      plt.title(obj_names[i])
      plt.plot(x, meds, 'b-')
      plt.ylim((min(meds)-1, max(meds)+1))
  blue_line = mlines.Line2D([],[], color='blue', label='Median')
  red_line = mlines.Line2D([],[], color='red', label='IQR')
  plt.figlegend((blue_line, red_line), ('Median', 'IQR'), loc=9, bbox_to_anchor=(0.5, 0.075), ncol=2)
  plt.savefig(fig_name)
  plt.clf()
开发者ID:ai-se,项目名称:softgoals,代码行数:27,代码来源:plotter.py


示例7: rcp

def rcp(results, graphNames):
  rsltSize = results[0].size / 3 
  prec = range(0,rsltSize)
  precN = range(0,rsltSize)
  recall = range(0, rsltSize)

  for r in results:
    for x in range(0,rsltSize):
      numPos = float(r[0,x][0])
      if numPos == 0:
        prec[x] = 1
      else:
        prec[x] = r[0,x][2] / numPos

    for x in range(0,rsltSize):
      recall[x] = r[0,x][2] / float(r[0,x][1])

    for x in range(0,rsltSize):
      precN[x] = 1- prec[x]

    graph = plt.plot(precN,recall)
    graphs.append(graph)

  # plot settings
  plt.ylabel('Recall')
  plt.xlabel('1 - Precision')
  plt.axis([0, 1.0, 0, 1.0])
  plt.grid(True)

  # legend for our graphs
  plt.figlegend( (graphs), graphNames,'upper left')
开发者ID:crocdialer,项目名称:libccf,代码行数:31,代码来源:plotRCP.py


示例8: __init__

    def __init__(self, window, subplot_num, x_axis, dim=2):
        ax = window.add_subplot(subplot_num)
        l = len(x_axis)
        self.y = ax.plot(range(l), l*[-1,], '-',       # Obtain handle to y axis.
                         range(l), l*[-1,], '--',
                         marker='^'
                         )
        # Hack: because initially the graph has too few y points, compared to x points,
        # nothing should be shown on the graph.
        # The hack is that initial y axis is seto be be below in hell.
        self.y_data = []
        for i in range(dim):
            self.y_data.append( col.deque(len(x_axis)*[-9999,],          # Circular buffer.
                                          maxlen=len(x_axis)
                                          )
                              )

        # Make plot prettier
        plt.grid(True)
        plt.tight_layout()
        ax.set_ylim(MIN_TEMP, MAX_TEMP)
        plt.figlegend(self.y, ('tempr', 'ctrl'), 'upper right');
        ax.set_ylabel('temperature [C]')
        # Terrible hack!
        if subplot_num == 121:
            ax.set_xlabel('time [s]')
        else:
            ax.set_xlabel('time [min]')
开发者ID:MiroslavVitkov,项目名称:rtplot,代码行数:28,代码来源:plot.py


示例9: plotDif

def plotDif(leap, est, tMag, setName):
    styleL = ["solid", "dashed", "dotted", "dashdot"]
    if len(est[0]) == 3:
        leap = leap[:, :-1]

    plt.figure()

    statesP = plt.subplot(211)

    #    for i in range(0,len(est[0]),1):
    for i in range(0, 1, 4):
        statesP.plot(tMag, leap[:, i], c="r", ls=styleL[i])
        statesP.plot(tMag, est[:, i], c="g", ls=styleL[i])

    #    statesP.legend()
    statesP.set_ylabel("Angle [rad]")
    statesP.set_title("Difference " + setName)

    difP = plt.subplot(212)
    dif = leap - est[:, :4]
    normedDif = np.linalg.norm(dif, axis=1)

    difP.plot(tMag, normedDif, c="g", ls="-")

    difP.set_ylabel("Normed Difference [rad]")
    difP.set_xlabel("Time [sec]")

    linePerf = mlines.Line2D([], [], color="r", markersize=15, label="Leap")
    lineEst = mlines.Line2D([], [], color="g", markersize=15, label="Estimated")
    plt.figlegend((linePerf, lineEst), ("Leap", "Estimated"), loc="upper right")
开发者ID:MuellerDaniel,项目名称:SensGlove,代码行数:30,代码来源:160226_leapVsEst.py


示例10: PlotGraphs

def PlotGraphs(posDistList, negDiNucDist, graphFileName):
	global threeUtrValues, threeUtrErrors;

	import matplotlib
	matplotlib.use('Agg')
	
	from matplotlib import pyplot as plt	
	matplotlib.rcParams.update({'font.size': 8})

	posMeanValues = [x[0] for x in posDistList.values()]
	posErrorValues = [x[1] for x in posDistList.values()]	

	negMeanValues = [x[0] for x in negDiNucDist.values()]
	negErrorValues = [x[1] for x in negDiNucDist.values()]	

	#Two subplots, the axes array is 1-d
	fig, (ax1, ax2) = plt.subplots(nrows=2)
	fig.suptitle("Di-nucleotide distribution: 3'UTR vs Generated Files", fontsize=8)
	labels = posDistList.keys();
	eb1, eb2 = distribution_plot(ax1, "Positive Set", posMeanValues, posErrorValues, labels);
	eb1, eb2 = distribution_plot(ax2, "Negative Set", negMeanValues, negErrorValues, labels);

	plt.figlegend((eb1, eb2), ("Generated", "3'UTR"), loc = 'lower right');
	plt.savefig(graphFileName);
	plt.close(fig)
开发者ID:shwetabhandare,项目名称:PySG,代码行数:25,代码来源:generateGraphs.py


示例11: VisualizeReferenceSpectrum

def VisualizeReferenceSpectrum(rf_files, freq_sampling):
    plt.figure(1, figsize=(5, 4))
    handles = []
    labels = []
    for rf_file in rf_files:
        ComponentType = itk.ctype('float')
        Dimension = 2
        ImageType = itk.VectorImage[ComponentType, Dimension]
        reader = itk.ImageFileReader[ImageType].New(FileName=rf_file)
        reader.Update()
        image = reader.GetOutput()
        arr = itk.GetArrayFromImage(image)
        arr /= arr[:,:,arr.shape[2]/3-arr.shape[2]/5:arr.shape[2]/2+arr.shape[2]/5].max()
        freq = np.linspace(freq_sampling / 2 / arr.shape[2], freq_sampling / 2, arr.shape[2])
        ax = plt.plot(freq, arr[0, 0, :].ravel(), label=rf_file)
        handles.append(ax[0])
        labels.append(rf_file)
        plt.xlabel('Frequency [Hz]')
        plt.ylabel('Power spectrum [V]')
    plt.figlegend(handles, labels, 'upper right')
    plt.ylim(0.0, 1.0)

    dirname = os.path.dirname(rf_files[0])
    plt.savefig(os.path.join(dirname, 'ReferenceSpectrum.png'), dpi=300)
    plt.show()
开发者ID:KitwareMedical,项目名称:FAST,代码行数:25,代码来源:Visualize_Reference_Spectrum.py


示例12: model_effects_plot

def model_effects_plot():
    grs = linspace(0.01,1,15)
    simple = grs
    neg = linspace(-0.4,0.01,6)
    simple = simple/simple.mean()
    degraded = grs+0.4
    degmean = degraded.mean()
    degraded = degraded/degmean
    neg_deg = neg+0.4
    neg_deg = neg_deg/degmean
    rate = 1/(1+0.2/grs)
    rate_effect = grs/rate
    rate_effect = rate_effect/rate_effect.mean()
    figure(figsize=(5,3))
    ax = subplot(111)
    ax.plot(grs,simple,'o',label="Unregulated protein - basic model")
    ax.plot(grs,degraded,'o',label="Unregulated protein - with degradation")
    ax.plot(neg,neg_deg,'--g')
    ax.plot(grs,rate_effect,'o',label="Unregulated protein - under decreasing biosynthesis rate")
    ax.plot(grs,rate,'--r',label="Biosynthesis rate")
    ax.annotate("degradation\nrate", xy=(-0.4,0),xytext=(-0.4,.6),arrowprops=dict(facecolor='black',shrink=0.05,width=1,headwidth=4),horizontalalignment='center',verticalalignment='center',fontsize=8)
    ax.set_xlim(xmin=-0.5)
    ax.set_ylim(ymin=0.)
    ax.set_xlabel('Growth rate [$h^{-1}$]',fontsize=8)
    set_ticks(ax,6)
    ax.spines['left'].set_position('zero')
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    ax.set_ylabel('Normalized protein concentration',fontsize=8)
    tight_layout()
    subplots_adjust(top=0.83)
    handles,labels=ax.get_legend_handles_labels()
    figlegend(handles,labels,fontsize=6,mode='expand',loc='upper left',bbox_to_anchor=(0.0,0.8,1,0.2),ncol=2,numpoints=1)
    savefig('TheoreticalModelEffects.pdf')
    close()
开发者ID:uriba,项目名称:proteome-analysis,代码行数:35,代码来源:proteome-analysis.py


示例13: plot_all_dbs_hist

def plot_all_dbs_hist():
    figure(figsize=(6.5,5))
    dbs = ['Heinemann-chemo','Peebo-gluc','Valgepea','HuiAlim','HuiClim','HuiRlim']
    dbext = {'Heinemann-chemo':'','Peebo-gluc':'','Valgepea':'','HuiAlim':', A-lim','HuiClim':', C-lim','HuiRlim':', R-lim'}
    p=subplot(111)
    for i,db in enumerate(dbs):
        ps = subplot(231+i)
        conds,gr,conc_data = datas[""][db]
        plot_corr_hist(ps,db,conc_data,categories)
        if db == 'Valgepea':
            year = 2013
        else:
            year = 2015
        ps.annotate("data from %s et. al. %d%s" % (db_name[db],year,dbext[db]),xy=(0.5,0.5),xytext=(-0.87,303),fontsize=6,zorder=10)
        ps.set_ylim(0,350)
        ps.set_xlim(-1,1)
        ps.annotate(chr(65+i),xy=(0.5,0.5),xytext=(-0.87,320),fontsize=10,zorder=10)

    #assume both subplots have the same categories.
    handles,labels=ps.get_legend_handles_labels()

    tight_layout()
    figlegend(handles,labels,fontsize=6,mode='expand',loc='upper left',bbox_to_anchor=(0.15,0.8,0.7,0.2),ncol=2)

    subplots_adjust(top=0.9)
    #fig = gcf()
    #py.plot_mpl(fig,filename="Growth rate Correlation histograms")
    savefig('AllDbsGrowthRateCorrelation.pdf')
    close()
开发者ID:uriba,项目名称:proteome-analysis,代码行数:29,代码来源:proteome-analysis.py


示例14: regional_sa

def regional_sa(model, expr, policy={}, nsamples=1000):
    samples = sample_lhs(model, nsamples)
    output = evaluate(model, overwrite(samples, policy))
    classification = output.apply(expr)
    classes = sorted(set(classification))
    fig, axarr = plt.subplots(1, len(model.uncertainties))
    lines = []
    
    for i, u in enumerate(model.uncertainties):
        for k in classes:
            indices = [classification[j] == k for j in range(len(classification))]
            values = [output[j][u.name] for j in range(len(indices)) if indices[j]]
            sorted_values = sorted(enumerate(values), key=operator.itemgetter(1))
            h = axarr[i].plot([v[1] for v in sorted_values], np.arange(len(values))/float(len(values)-1))
            lines.append(h[0])
            
        values = [output[j][u.name] for j in range(len(indices))]
        sorted_values = sorted(enumerate(values), key=operator.itemgetter(1))
        h = axarr[i].plot([v[1] for v in sorted_values], np.arange(len(values))/float(len(values)-1))
        lines.append(h[0])
        
        axarr[i].set_title(u.name)
        
    plt.figlegend(lines[:len(classes)] + [lines[-1]],
                  map(str, classes) + ["Unconditioned"],
                  loc='lower center',
                  ncol=3,
                  labelspacing=0. )
    
    return fig
开发者ID:arita37,项目名称:Rhodium,代码行数:30,代码来源:sa.py


示例15: rank_plot

 def rank_plot(self, rank_thresh = 100, show = True, filename = None):
     """Returns plot of the frequencies of the attributes, sorted by rank."""
     plt.figure()
     afdf = self.attr_freq_df(rank_thresh)
     cmap = plt.cm.gist_ncar
     colors = {i : cmap(int((i + 1) * cmap.N / (self.num_attr_types + 1.0))) for i in range(self.num_attr_types)}
     fig, (ax1, ax2) = plt.subplots(2, 1, sharex = False, sharey = False, facecolor = 'white')
     plots_for_legend = []
     for (i, t) in enumerate(self.attr_types):
         afdf_for_type = afdf[afdf['type'] == t]
         plots_for_legend.append(ax1.plot(afdf_for_type['rank'], np.log10(afdf_for_type['freq']), color = colors[i], linewidth = 2)[0])
         ax2.plot(afdf_for_type['rank'], afdf_for_type['cumulative %'], color = colors[i], linewidth = 2)
     ax1.set_title('Attribute frequencies by type', fontweight = 'bold')
     ax2.set_xlabel('rank')
     ax1.set_ylabel('log10(freq)')
     ax2.set_ylabel('cumulative %')
     ax2.set_ylim((0, 100))
     ax1.grid(True, 'major', color = 'w', linestyle = '-')
     ax2.grid(True, 'major', color = 'w', linestyle = '-')
     ax1.set_axisbelow(True)
     ax2.set_axisbelow(True)
     ax1.patch.set_facecolor('0.89')
     ax2.patch.set_facecolor('0.89')
     plt.figlegend(plots_for_legend, self.attr_types, 'right', fontsize = 10)
     if filename:
         plt.savefig(filename)
     if show:
         plt.show(block = False)
开发者ID:jeremander,项目名称:AttrVN,代码行数:28,代码来源:attr_vn.py


示例16: plot_points

def plot_points(means_common, means_extra_ms, mean_extra_e, labels):
	ind = np.arange(len(labels))  # the x locations for the groups
	width = 0.2       # the width of the bars

	fig, ax = plt.subplots()
	rects1 = ax.bar(ind + 0.2, means_extra_ms, width, color='r')
	rects2 = ax.bar(ind + 0.4, means_common, width, color='g')
	rects3 = ax.bar(ind + 0.6, means_extra_e, width, color='b')

	# add some text for labels, title and axes ticks
	ax.set_ylabel('Number of points')
	ax.set_title('Point comparison')
	ax.set_xticks(ind+3*width)
	ax.set_xticklabels( tuple(labels) )
	
	plt.ylim(ymin = 0, ymax = 100)

	plt.figlegend( (rects1, rects2, rects3), ('Unique in MATSim route', 'Common points', 'Unique in estimated route'), 'upper right' )

	def autolabel(rects):
	    # attach some text labels
	    for rect in rects:
	        height = rect.get_height()
	        ax.text(rect.get_x()+0.6*rect.get_width(), 1.05*height, str(int(height)),
	                ha='center', va='bottom')

	autolabel(rects1)
	autolabel(rects2)
	autolabel(rects3)
开发者ID:bitsteller,项目名称:cells2flows,代码行数:29,代码来源:validate_routes.py


示例17: plotMulti

def plotMulti(leap, mag, time):
    """ plot only flex-ext of MCP """

    colorL = ["red", "green", "blue", "yellow"]
    a = plt.subplot(211)
    state = 0
    for i in range(0, len(leap), 1):
        a.plot(time, leap[i][:, state], c=colorL[i], ls="-")
        a.plot(time, mag[:, i * 4 + state], c=colorL[i], ls="--")

    dif = plt.subplot(212)
    state = 1
    for i in range(0, len(leap), 1):
        dif.plot(time, leap[i][:, state], c=colorL[i], ls="-")
        dif.plot(time, mag[:, i * 4 + state], c=colorL[i], ls="--")

    lineInd = mlines.Line2D([], [], color="r", markersize=15, label="Index")
    lineMid = mlines.Line2D([], [], color="g", markersize=15, label="Middle")

    lineLeap = mlines.Line2D([], [], color="k", linestyle="-", markersize=15, label="Leap")
    lineEst = mlines.Line2D([], [], color="k", linestyle="--", markersize=15, label="Estimated")

    plt.figlegend(
        (lineInd, lineMid, lineLeap, lineEst), ("Index", "Middle", "Leap", "Estimated"), loc="upper center", ncol=2
    )
开发者ID:MuellerDaniel,项目名称:SensGlove,代码行数:25,代码来源:160226_leapVsEst.py


示例18: loglogplot

def loglogplot(l, title = None, names = None):
    a = np.array(l).transpose((1,2,0))
    mp.figure()
    lines = mp.loglog(1.0 / a[0], a[1])
    if title: mp.suptitle(title)
    if len(lines) > 1:
        if names is None: names = range(len(lines)) 
        mp.figlegend(lines, names, 'right')
开发者ID:tbetcke,项目名称:PyPWDG,代码行数:8,代码来源:jcpexamples.py


示例19: plot_timfile

def plot_timfile(timfile):
    """Make a plot summarizing a timfile.

        Input:
            timfile: A row of info of the timfile to summarize.

        Output:
            None
    """
    import matplotlib.pyplot as plt
    import matplotlib
    
    COLOURS = ['k', 'g', 'r', 'b', 'm', 'c', 'y']
    ncolours = len(COLOURS)
    BANDS = ['UHF', 'L-band', 'S-band']
    numbands = len(BANDS)
    toas = get_timfiles_toas(timfile['timfile_id'])
    obssys_ids = set()
    for toa in toas:
        obssys_ids.add(toa['obssystem_id'])
    obssys_ids = list(obssys_ids)
    fig = plt.figure()
    ax = plt.axes((0.1, 0.15, 0.85, 0.75))
    lomjd = 70000
    himjd = 10000
    artists = []
    for toa in toas:
        ind = BANDS.index(toa['band_descriptor'])
        ymin = float(ind)/numbands
        ymax = float(ind+1)/numbands
        cc = COLOURS[obssys_ids.index(toa['obssystem_id']) % ncolours]
        artists.append(plt.axvline(toa['mjd'], ymin, ymax, c=cc))
        himjd = max(himjd, toa['mjd'])
        lomjd = min(lomjd, toa['mjd'])
    plt.xlabel("MJD")
    plt.yticks(np.arange(0.5/numbands, 1, 1.0/numbands), BANDS,
               rotation=30, va='top')
    plt.xlim(lomjd, himjd)
    patches = []
    obssystems = []
    for ii, obssys_id in enumerate(obssys_ids):
        cc = COLOURS[ii % ncolours]
        patches.append(matplotlib.patches.Patch(fc=cc))
        obssystems.append(cache.get_obssysinfo(obssys_id)['name'])
    plt.figlegend(patches, obssystems, 'lower center', ncol=4,
                  prop=dict(size='small'))

    def change_thickness(event):
        if event.key == '=':
            for art in artists:
                lw = art.get_linewidth()
                art.set_linewidth(lw+0.5)
        elif event.key == '-':
            for art in artists:
                lw = art.get_linewidth()
                art.set_linewidth(max(1, lw-0.5))
        plt.draw()
    fig.canvas.mpl_connect('key_press_event', change_thickness)
开发者ID:plazar,项目名称:TOASTER,代码行数:58,代码来源:describe_timfiles.py


示例20: visualize2

def visualize2(path):
    print("Processing path {0}...".format(path))
    data = built_converged_data(path)

    inums_oldpop = dict()
    inums_random = dict()
    for wf_name, tasks in data.items():
        for task_id, (old_pop_results, random_results) in _sort_dict(tasks):



            for inum, record in _sort_dict(old_pop_results):
                if int(inum) in points:
                    dt = inums_oldpop.get(inum, [])
                    dt.append(record["best_avr"])
                    inums_oldpop[inum] = dt

            for inum, record in _sort_dict(random_results):
                if int(inum) in points:
                    dt = inums_random.get(inum, [])
                    dt.append(record["best_avr"])
                    inums_random[inum] = dt
            pass



    result_oldpop = {i: sum(values)/len(values) for i, values in inums_oldpop.items()}
    result_random = {i: sum(values)/len(values) for i, values in inums_random.items()}

    result = {i_1: (1 - v_1/v_2)*100 for((i_1, v_1), (i_2, v_2)) in zip_longest(_sort_dict(result_oldpop), _sort_dict(result_random))}

    plt.figure(figsize=(10, 10))
    plt.grid(True)
    ax = plt.gca()
    ax.set_xlim(0, len(points))
    ax.set_xscale('linear')
    plt.xticks(range(0, len(points)))
    ax.set_xticklabels(points)
    ax.set_title("Overall")
    plt.yticks([i/5 for i in range(0, 100)])

    data = [v for (i, v) in _sort_dict(result)]
    plt.plot(data, '-bx')

    h1 = Rectangle((0, 0), 1, 1, fc="r")
    h2 = Rectangle((0, 0), 1, 1, fc="g")
    h3 = Rectangle((0, 0), 1, 1, fc="b")



    plt.suptitle('Average of Best vs Average of Avr', fontsize=20)
    plt.figlegend([h1, h2, h3], ['with old pop', 'random', 'perf profit'], loc='lower center', ncol=10, labelspacing=0. )
    plt.subplots_adjust(hspace=0.5)
    plt.savefig(path + "overall.png", dpi=128.0, format="png")
    plt.clf()
    pass
开发者ID:fonhorst,项目名称:heft,代码行数:56,代码来源:DrawConvergenceResults.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyplot.fignum_exists函数代码示例发布时间:2022-05-27
下一篇:
Python pyplot.figimage函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap