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

Python pyplot.rc函数代码示例

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

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



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

示例1: plot

def plot(title, dates, lines, labels, count, name, wdir):
    
    N = len(dates)                                                                                  
    start = N - count                                                                               
    date_idx = range(count)                                                                         
                                                                                                    
    def format_date(x, pos=None):                                                                   
        idx = start + int(x)                                                                        
        if idx >= N:                                                                                
            idx = N - 1                                                                             
        return dates[idx].strftime('%m-%d')                                                         
                                                                                                    
    plt.rcParams.update({'font.size': 9})                                                           
    plt.rc('legend', **{'fontsize':8})                                                              
                                                                                                    
    fig = plt.figure()                                                                              
#    ax = fig.add_subplot(111)                                                                      
    ax = fig.add_axes([0.075, 0.125, 0.68, 0.765])                                                  
    handles = []                                                                                    
    for i in range(len(lines)):                                                                     
        handle = ax.plot(date_idx, lines[i][start:], label=labels[i])    
        handles.append(handle)                                                                      
    ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date))                                 
                                                                                                    
    fig.autofmt_xdate()                                                                             
    fig.set_size_inches(4.25, 2.15)                                                                 
    fig.legend(handles, labels, 'upper right')                                                      
    plt.title(title)                                                                                
    
    filename = wdir + '\\' + name + '.png'                                                                                                              
#    plt.show()                                                                                     
    plt.savefig(filename)
    
    return (name, filename)                                                                     
开发者ID:abuzayed,项目名称:tagalyat,代码行数:34,代码来源:finlib.py


示例2: plot_all

def plot_all():

    font = {'family': 'serif',
            'weight': 'normal',
            'size': 12,
            }

    plt.rc('font', **font)

    data = DataReader('dyn_spin.txt')
    ts = data['time']

    fig = plt.figure(figsize=(5, 4))

    mx = data['m_x']
    my = data['m_y']
    mz = data['m_z']
    plt.plot(ts, mx, '-', label='mx', color='b')
    plt.plot(ts, my, '-', label='my', color='g')
    plt.plot(ts[::6], mz[::6],'.-', label='mz',  color='r')

    plt.legend(bbox_to_anchor=[0.8, 0.8], shadow=True, frameon=True)
    #plt.xlim([0, 1.01])

    plt.legend()

    plt.xlabel('Time')
    plt.ylabel('m')
    plt.tight_layout()
    fig.savefig('m_ts.pdf')
开发者ID:computationalmodelling,项目名称:fidimag,代码行数:30,代码来源:single_spin_stt.py


示例3: plot

def plot(filename):
    import os
    from matplotlib.pyplot import clf, tricontour, tricontourf, \
        gca, savefig, rc, minorticks_on

    if not os.path.exists(filename):
        return -1

    rc('text', usetex=True)
    clf()
    x, y, tri, ux, uy = load_velocity(filename)
    tricontourf(x, y, tri, ux, 16)
    tricontour(x, y, tri, ux, 16, linestyles='-',
               colors='black', linewidths=0.5)
    minorticks_on()
    gca().set_aspect('equal')
    gca().tick_params(direction='out', which='both')
    gca().set_xticklabels([])
    gca().set_yticklabels([])

    name, _ = os.path.splitext(filename)
    name = os.path.basename(name)

    savefig('{0}.png'.format(name), dpi=300, bbox_inches='tight')
    savefig('{0}.pdf'.format(name), bbox_inches='tight')
开发者ID:mrklein,项目名称:vtk-plot,代码行数:25,代码来源:plot-vtk.py


示例4: dim_sensitivity_plot

def dim_sensitivity_plot(x, Y, fname, show_legend=True):

    plt.rc('text', usetex=True)
    plt.rc('font', family='serif')

    plt.figure(figsize=(3, 3))
    plt.xlabel('$d$', size=FONTSIZE)
    plt.ylabel('ROC AUC', size=FONTSIZE)

    plt.set_cmap('Set2')

    lines = []
    for i, label in enumerate(KEYS):
        line_data = Y.get(label)

        if line_data is None:
            continue
        
        line, = plt.plot(x, line_data, label=label, marker=MARKERS[i],
                         markersize=0.5 * FONTSIZE, color=COLORS[i])
        lines.append(line)



    if show_legend:
        plt.legend(handles=lines)
        plt.legend(loc='lower right')
    plt.xscale('log', basex=2)
    plt.xticks(x, [str(y) for y in x], size=FONTSIZE)
    plt.yticks(size=FONTSIZE)
    plt.tight_layout()

    plt.savefig(fname)
开发者ID:hbudyanto,项目名称:lightfm-paper,代码行数:33,代码来源:plots.py


示例5: 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


示例6: plot

    def plot(self, debug = False):
	"""plot figures for population, nuisance parameters"""
	# first figure out what scheme is used
	self.list_scheme()

	# next get MABR sampling done
	self.MBAR_analysis()

	# load in precomputed P and dP from MBAR analysis
        pops0, pops1   = self.P_dP[:,0], self.P_dP[:,self.K-1]
        dpops0, dpops1 = self.P_dP[:,self.K], self.P_dP[:,2*self.K-1]
	t0 = self.traj[0]
    	t1 = self.traj[self.K-1]

        # Figure Plot SETTINGS
        label_fontsize = 12
        legend_fontsize = 10
        fontfamily={'family':'sans-serif','sans-serif':['Arial']}
        plt.rc('font', **fontfamily)

        # determine number of row and column
        if (len(self.scheme)+1)%2 != 0:
            c,r = 2, (len(self.scheme)+2)/2
    	else:
            c,r = 2, (len(self.scheme)+1)/2
    	plt.figure( figsize=(4*c,5*r) )
    	# Make a subplot in the upper left
    	plt.subplot(r,c,1)
    	plt.errorbar( pops0, pops1, xerr=dpops0, yerr=dpops1, fmt='k.')
    	plt.hold(True)
    	plt.plot([1e-6, 1], [1e-6, 1], color='k', linestyle='-', linewidth=2)
    	plt.xlim(1e-6, 1.)
    	plt.ylim(1e-6, 1.)
    	plt.xlabel('$p_i$ (exp)', fontsize=label_fontsize)
    	plt.ylabel('$p_i$ (sim+exp)', fontsize=label_fontsize)
    	plt.xscale('log')
    	plt.yscale('log')
    	# label key states
    	plt.hold(True)
    	for i in range(len(pops1)):
        	if (i==0) or (pops1[i] > 0.05):
            		plt.text( pops0[i], pops1[i], str(i), color='g' )
    	for k in range(len(self.scheme)):
        	plt.subplot(r,c,k+2)
        	plt.step(t0['allowed_'+self.scheme[k]], t0['sampled_'+self.scheme[k]], 'b-')
        	plt.hold(True)
        	plt.xlim(0,5)
        	plt.step(t1['allowed_'+self.scheme[k]], t1['sampled_'+self.scheme[k]], 'r-')
        	plt.legend(['exp', 'sim+exp'], fontsize=legend_fontsize)
        	if self.scheme[k].find('cs') == -1:
            		plt.xlabel("$\%s$"%self.scheme[k], fontsize=label_fontsize)
            		plt.ylabel("$P(\%s)$"%self.scheme[k], fontsize=label_fontsize)
            		plt.yticks([])
        	else:
            		plt.xlabel("$\sigma_{%s}$"%self.scheme[k][6:],fontsize=label_fontsize)
            		plt.ylabel("$P(\sigma_{%s})$"%self.scheme[k][6:],fontsize=label_fontsize)
            		plt.yticks([])

    	plt.tight_layout()
    	plt.savefig(self.picfile)
开发者ID:vvoelz,项目名称:nmr-biceps,代码行数:60,代码来源:Analysis.py


示例7: PlotData

def PlotData(Stock,buyselldata):
    plt.rc('axes', grid=True)
    plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5)
    
    textsize = 9
    left, width = 0.1, 0.8
    rect1 = [left, 0.1, width, 0.9]

    fig = plt.figure(facecolor='white')
    axescolor  = '#f6f6f6'  # the axies background color

    ax1 = fig.add_axes(rect1, axisbg=axescolor)  #left, bottom, width, height

    ### plot the relative strength indicator
    prices = Stock.close
   
    fillcolor = 'darkgoldenrod'
    
    plt.plot(Stock.date, prices, color=fillcolor)            
    for i in buyselldata[0]:
        plt.plot(Stock.date[i],prices[i],'bo')
    for i in buyselldata[1]:
        plt.plot(Stock.date[i],prices[i],'rx')
    plt.show()            
            
开发者ID:steffejr,项目名称:ForeCast,代码行数:24,代码来源:092611.py


示例8: make_rainbow

def make_rainbow(a=0.75, b=0.2, name='custom_rainbow', register=False):
    """
    Use a=0.7, b=0.2 for a darker end.

    when 0.5<=a<=1.5, should have b >= (a-0.5)/2 or 0 <= b <= (a-1)/3
    when 0<=a<=0.5, should have b >= (0.5-a)/2 or 0<= b<= -a/3
    to assert the monoique

    To show the parameter dependencies interactively in notebook
    ```
    %matplotlib inline
    from ipywidgets import interact
    def func(a=0.75, b=0.2):
        cmap = gene_rainbow(a=a, b=b)
        show_cmap(cmap)
    interact(func, a=(0, 1, 0.05), b=(0.1, 0.5, 0.05))
    ```
    """
    def gfunc(a, b, c=1):
        def func(x):
            return c * np.exp(-0.5 * (x - a)**2 / b**2)
        return func

    cdict = {"red": gfunc(a, b),
             "green": gfunc(0.5, b),
             "blue": gfunc(1 - a, b)
             }
    cmap = mpl.colors.LinearSegmentedColormap(name, cdict)
    if register:
        plt.register_cmap(cmap=cmap)
        plt.rc('image', cmap=cmap.name)
    return cmap
开发者ID:syrte,项目名称:handy,代码行数:32,代码来源:cmap.py


示例9: make_x_plot

def make_x_plot():
	from numpy import linspace
	from matplotlib import pyplot as pl
	pl.rc('text', usetex=True)
	pl.rc('font', family='serif')
	lamdas = [-1,-0.9,-0.7,0,0.7,0.9,1]
	for lam in lamdas:
		plotx(lam,0)
		plotx(lam,1,linestyle='k--')
		plotx(lam,2)
		plotx(lam,3,linestyle='k--')
	pl.axvline(x=1,color='k')
	pl.xlabel(r'$$x$$',fontsize=16)
	pl.ylabel(r'$$T$$',fontsize=16)
	pl.text(0.0, 1.5, r'$$M=0$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(0.0, 4.7, r'$$M=1$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(0.0, 8.0, r'$$M=2$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(0.5, 4, r'hyperbolic')
	pl.text(1.2, 4, r'elliptic')
	pl.annotate(r'$$\lambda = 1$$', xy=(-0.25, 1.1), xytext=(-0.8, 0.2),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
	pl.annotate(r'$$\lambda = -1$$', xy=(0.5, 2.0), xytext=(0.7, 3.0),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
开发者ID:darioizzo,项目名称:lambert,代码行数:25,代码来源:lambert.py


示例10: prepare_figure

def prepare_figure(obj_area):

    # create new figure 
    #fig = Figure()  # old version, does not work for the stream plot 

    ## Turn interactive plotting off
    #plt.ioff()
    fig = plt.figure()   # needs a DISPLAY environment variable (simulated here with mpl.use('Agg'))

    # define size of image 
    nx = obj_area.x_size
    ny = obj_area.y_size
    # canvas figure 
    canvas = FigureCanvas(fig)
    # get dots per inch of the screen
    DPI = fig.get_dpi()
    # print "DPI", DPI
    fig.set_size_inches(nx/float(DPI),ny/float(DPI))
    # set fonts to bold
    plt.rc('font', weight='bold')
    # get axis object 
    ax = fig.add_subplot(111, aspect='equal')
    ## eliminates margins totally 
    fig.subplots_adjust(left=0.0,right=1.0,bottom=0.0,top=1.0, wspace=0, hspace=0)
    # set limits of the axis
    ax.set_xlim(0, nx)
    ax.set_ylim(0, ny)
    # set transparent backgroud 
    fig.patch.set_alpha(0.0)        # transparent outside of diagram  
    ax.set_axis_bgcolor([1,0,0,0])  # transparent color inside diagram 

    return fig, ax 
开发者ID:pytroll,项目名称:mpop,代码行数:32,代码来源:HRWimage.py


示例11: plot

def plot(results, total_a, total_b, label_a, label_b, outputFile=None):
    all_rules = sorted(results, key=lambda v: (-len(v['item']), round(abs(v['count_a'] / total_a - v['count_b'] / total_b), 2), round(v['count_a'] / total_a, 2)))

    values_a = [100 * rule['count_a'] / total_a for rule in all_rules]
    values_b = [100 * rule['count_b'] / total_b for rule in all_rules]

    plt.rc('figure', autolayout=True)
    plt.rc('font', size=22)

    fig, ax = plt.subplots(figsize=(24, 18))
    index = range(len(all_rules))
    bar_width = 0.35

    if label_a.startswith('_'):
        label_a = ' ' + label_a
    if label_b.startswith('_'):
        label_b = ' ' + label_b

    bar_a = plt.barh(index, values_a, bar_width, color='b', label=label_a)
    bar_b = plt.barh([i + bar_width for i in index], values_b, bar_width, color='r', label=label_b)

    plt.xlabel('Support')
    plt.ylabel('Rule')
    plt.title('Most interesting deviations')
    plt.yticks([i + bar_width for i in index], [rule_to_str(rule['item']) for rule in all_rules])
    if len(all_rules) > 0:
        plt.legend(handles=[bar_b, bar_a], loc='best')

    if outputFile is not None:
        plt.savefig(outputFile)
    else:
        plt.show()
    plt.close(fig)
开发者ID:marco-c,项目名称:crashcorrelations,代码行数:33,代码来源:plot.py


示例12: plot_bars

def plot_bars(groups, group_labels, legends, ylabel, yscale=None):
  N = len(group_labels)

  ind = np.arange(N)  # the x locations for the groups
  width = 0.1       # the width of the bars

  plt.rc('xtick', labelsize=12) 
  plt.rc('ytick', labelsize=12) 
  fig = plt.figure(figsize=(14,7), dpi=300)
  ax = fig.add_subplot(111)

  colors = ['b', 'r', 'y', 'g', 'm']

  rects = []
  i = 0
  for group in groups:
    rects.append(ax.bar(ind + ((i + 3) * 1.0 * width), group, width, bottom=10**-3, color=colors[i]))
    i += 1
  
  ax.set_xticks(ind+0.5+width)
  ax.set_xticklabels( group_labels )

  box = ax.get_position()
  ax.set_position([box.x0, box.y0, box.width * 0.95, box.height])
  ax.legend(rects, legends, loc='center left', bbox_to_anchor=(1, 0.5), prop={'size':14})

  if yscale != None:
    plt.yscale(yscale)

  plt.ylabel(ylabel, fontsize=14)
  return plt
开发者ID:rcillo,项目名称:morph-doc-segmentation,代码行数:31,代码来源:measures.py


示例13: printEnrichment

def printEnrichment(controlVsTestTupleList, proteinGroupsDataFrame, go_to_SGDID,sgdidList):
    f, axarr = plt.subplots(4, 2)
    f.subplots_adjust(hspace = 0.75)
    i = 0
    j = 0
    font ={'family':'normal', 'weight':'bold', 'size':8}
    plt.rc('font', **font)

    for (control, test) in controlVsTestTupleList:
        e1, n1 = calculate_enrichment(test, proteinGroupsDataFrame, go_to_SGDID,sgdidList)
        e0, n0 = calculate_enrichment(control, proteinGroupsDataFrame, go_to_SGDID,sgdidList)
        e0list, e1list, egoidlist, emaxlist = checkGoLengths(e0, e1)
        n0list, n1list, ngoidlist, nmaxlist = checkGoLengths(n0, n1)
        maxlist = [emaxlist[0], emaxlist[1], nmaxlist[0], nmaxlist[1]]
        axarr[i, j].plot(e0list, e1list, 'b.')
        axarr[i, j].plot(n0list, n1list, 'r.')
        axarr[i, j].set_title(control +'vs'+ test, fontsize=8)
        axarr[i, j].set_xlabel('control')
        axarr[i, j].set_ylabel('test') 
        axarr[i, j].set_xlim([0, max(maxlist)])
        axarr[i, j].set_ylim([0, max(maxlist)])
        """index = 0
        #to add all go ids to plot
        for xy in zip(e0list, e1list):                                               
            axarr[i, j].annotate('%s' % egoidlist[index], xy=xy, textcoords='data')
        index+=1"""
        if j == 1:
            i+=1
            j=0
        else:
            j+=1
    plt.show()
开发者ID:chelsell,项目名称:whangee_pubs,代码行数:32,代码来源:mass_spec_analysis.py


示例14: features_pca_classified

def features_pca_classified(fscaled, labels_true, labels_predict, axes=None,
                            algorithm="pca"):
    if algorithm == 'pca':
        pc = PCA(n_components=2)
        fscaled_trans = pc.fit(fscaled).transform(fscaled)
    elif algorithm == "tsne":
        fscaled_trans = TSNE(n_components=2).fit_transform(fscaled)
    else:
        raise AlgorithmUnrecognizedException("Not recognizing method of "+
                                             "dimensionality reduction.")

    sns.set_style("whitegrid")
    plt.rc("font", size=24, family="serif", serif="Computer Sans")
    plt.rc("axes", titlesize=20, labelsize=20)
    plt.rc("text", usetex=True)
    plt.rc('xtick', labelsize=20)
    plt.rc('ytick', labelsize=20)

    # make a Figure object
    if axes is None:
        fig, axes = plt.subplots(1,2,figsize=(16,6), sharey=True)

    ax1, ax2 = axes[0], axes[1]

    ax1 = plotting.scatter(fscaled_trans, labels_true, ax=ax1)

    # second panel: physical labels:

    ax2 = plotting.scatter(fscaled_trans, labels_predict, ax=ax2)

    plt.tight_layout()

    return ax1, ax2
开发者ID:dhuppenkothen,项目名称:BlackHoleMagic,代码行数:33,代码来源:paper_figures.py


示例15: plotcurve

def plotcurve(xax,f1,f2,ct):
	fig, axes = plt.subplots(nrows=4, ncols=1, sharex=True)
	plt.minorticks_on()
	fig.subplots_adjust(hspace = 0.001)
	plt.rc('font', family='serif',serif='Times')
	y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=False)
	
	axes[0].plot(xax,f1[0],'D-',c='k',mec='b',fillstyle='none')
	axes[0].plot(xax,f2[0],'o-',c='g',mec='k',fillstyle='none')
	axes[0].set_ylabel(r'$raw$ $RMS$',fontsize=13)
	axes[0].yaxis.set_major_formatter(y_formatter)
	axes[0].yaxis.set_major_locator(MaxNLocator(prune='both',nbins=5))

	axes[1].plot(xax,f1[1],'D-',c='k',mec='b',fillstyle='none')
	axes[1].plot(xax,f2[1],'o-',c='g',mec='k',fillstyle='none')
	axes[1].set_ylabel(r'$frames$ $RMS$',fontsize=13)
	axes[1].yaxis.set_major_formatter(y_formatter)
	axes[1].yaxis.set_major_locator(MaxNLocator(prune='both',nbins=5))

	axes[2].plot(xax,f1[2],'D-',c='k',mec='b',fillstyle='none')
	axes[2].plot(xax,f2[2],'o-',c='g',mec='k',fillstyle='none')
	axes[2].set_ylabel(r'$\sigma-clipped$',fontsize=13)
	axes[2].yaxis.set_major_formatter(y_formatter)
	axes[2].yaxis.set_major_locator(MaxNLocator(prune='both',nbins=5))

	axes[3].plot(xax,f1[3],'D-',c='k',mec='b',fillstyle='none',label='Hard')
	axes[3].plot(xax,f2[3],'o-',c='g',mec='k',fillstyle='none',label='Soft')
	axes[3].set_ylabel(r'$\sigma$ $clipped$ $RMS$',fontsize=13)
	axes[3].set_xlabel(r'$aperture$ $(pixels)$',fontsize=13)
	axes[3].yaxis.set_major_formatter(y_formatter)
	axes[3].yaxis.set_major_locator(MaxNLocator(prune='both',nbins=5))
	axes[3].legend(numpoints=1)
	plt.savefig('paneltest/'+str(ct)+'updchanges.png',bbox_inches='tight',dpi=200)
开发者ID:sud11,项目名称:gsoc_mcgill,代码行数:33,代码来源:tim2.py


示例16: make_xi_plot

def make_xi_plot():
	from numpy import linspace
	from matplotlib import pyplot as pl
	pl.rc('text', usetex=True)
	pl.rc('font', family='serif')
	lamdas = [-1,-0.9,-0.7,0,0.7,0.9,1]
	for lam in lamdas:
		plotx(lam,0,linestyle='k',minval=-0.9,maxval=10.0,logplot=True)
		plotx(lam,1,linestyle='k--',logplot=True)
		plotx(lam,2,logplot=True)
		plotx(lam,3,linestyle='k--',logplot=True)
	pl.vlines(x=1,ymin=-2,ymax=-0.076,color='k')
	pl.xlabel(r'$$\xi$$',fontsize=16)
	pl.ylabel(r'$$\tau$$',fontsize=16)
	pl.text(0.0, 0, r'$$M=0$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(0.0, 1.4, r'$$M=1$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(0, 2.48, r'$$M=2$$', bbox=dict(facecolor='white', alpha=1))
	pl.text(1.3, -1.5, r'hyperbolic')
	pl.text(0.3, -1.5, r'elliptic')
	pl.annotate(r'$$\lambda = 1$$', xy=(-0.29, -0.19), xytext=(-1, -1),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
	pl.annotate(r'$$\lambda = -1$$', xy=(0.7, 0.4), xytext=(0.8,0.8),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
	pl.xlim((-2,2))
	pl.ylim((-2,3))
开发者ID:darioizzo,项目名称:lambert,代码行数:27,代码来源:lambert.py


示例17: visualize_data

def visualize_data(mnist):
    plt.rc("image",cmap="binary")
    plt.subplot(10,10,1)
    for i in range(100):
        plt.subplot(10,10,i)
        idx=np.random.randint(len(mnist.data))
        plt.imshow(mnist.data[idx].reshape(28,28))
开发者ID:qichaotang,项目名称:DataScienceSchool,代码行数:7,代码来源:lib_mnist.py


示例18: make_starter_plot

def make_starter_plot():
	from numpy import linspace
	from math import pi
	from matplotlib import pyplot as pl
	pl.rc('text', usetex=True)
	pl.rc('font', family='serif')
	pl.axvline(x=1,color='k')
	pl.xlabel(r'$$x$$',fontsize=16)
	pl.ylabel(r'$$T$$',fontsize=16)
	pl.text(0.5, 4, r'hyperbolic')
	pl.text(1.2, 4, r'elliptic')
	plot_x_curves([-1,-0.85,0.85,1],N=0,logplot=False,maxval=10,minval=-0.9)
	T0s = [pi,pi/2,1.1]
	for T0 in T0s:
		T  =linspace(T0,10*pi)
		pl.plot((T0/T)**(2.0/3.0)-1.0,T,':k')
		T  =linspace(0.1,T0)
		pl.plot((T0/T)**(1.0)-1.0,T,':k')
	pl.plot([],'k-',label="tof curves [-1,-0.85,0.85,1]")
	pl.plot([],'k:',label="initial guesses")
	pl.legend()
	pl.annotate(r'$$\lambda \le -0.85$$', xy=(-0.4, 7.5), xytext=(-0.1, 8),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
	pl.annotate(r'$$\lambda \ge 0.85$$', xy=(-0.33, 2.1), xytext=(-0.9, 1.09),
            arrowprops=dict(facecolor='black', shrink=0.15, width=1,headwidth=5),
            )
开发者ID:darioizzo,项目名称:lambert,代码行数:27,代码来源:lambert.py


示例19: test_tilde_in_tempfilename

def test_tilde_in_tempfilename():
    # Tilde ~ in the tempdir path (e.g. TMPDIR, TMP oder TEMP on windows
    # when the username is very long and windows uses a short name) breaks
    # latex before https://github.com/matplotlib/matplotlib/pull/5928
    import tempfile
    import shutil
    import os
    import os.path

    tempdir = None
    old_tempdir = tempfile.tempdir
    try:
        # change the path for new tempdirs, which is used
        # internally by the ps backend to write a file
        tempdir = tempfile.mkdtemp()
        base_tempdir = os.path.join(tempdir, "short~1")
        os.makedirs(base_tempdir)
        tempfile.tempdir = base_tempdir

        # usetex results in the latex call, which does not like the ~
        plt.rc('text', usetex=True)
        plt.plot([1, 2, 3, 4])
        plt.xlabel(r'\textbf{time} (s)')
        #matplotlib.verbose.set_level("debug")
        output_eps = os.path.join(base_tempdir, 'tex_demo.eps')
        # use the PS backend to write the file...
        plt.savefig(output_eps, format="ps")
    finally:
        tempfile.tempdir = old_tempdir
        if tempdir:
            try:
                shutil.rmtree(tempdir)
            except Exception as e:
                # do not break if this is not removeable...
                print(e)
开发者ID:Jajauma,项目名称:dotfiles,代码行数:35,代码来源:test_backend_ps.py


示例20: make_accuracy_plot

def make_accuracy_plot():
	from numpy import linspace, mean
	from math import pi
	from matplotlib import pyplot as pl
	pl.rc('text', usetex=True)
	pl.rc('font', family='serif')
	pl.axvline(x=1,color='k')
	pl.xlabel(r'$$\lambda$$',fontsize=16)
	pl.ylabel(r'$$\epsilon$$',fontsize=16)
	print "Testing M=0"
	it_list = list()
	#We test for zero revolutions
	err,it,la,x,T = test_standard(M=100000,gooding=False,
		house=True,tau=False,iter_max=15,eps=1e-5, rnd_seed=4562,N=0)
	it_list.append(mean(it))
	pl.semilogy(la,err,'k.')
	#We test for multiple revolutions
	for rev in range(50):
		print "Testing M=" + str(rev)
		err,it,la,x,T = test_standard(M=10000,gooding=False,
			house=True,tau=False,iter_max=15,eps=1e-8, rnd_seed=4562+rev+1,N=rev+1)
		pl.semilogy(la,err,'k.')
		it_list.append(mean(it))
	pl.figure()
	pl.plot(it_list)
开发者ID:darioizzo,项目名称:lambert,代码行数:25,代码来源:lambert.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pyplot.rc_context函数代码示例发布时间:2022-05-27
下一篇:
Python pyplot.quiverkey函数代码示例发布时间: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