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

Python rcParams.update函数代码示例

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

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



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

示例1: run_demo

def run_demo(path, ext, seed):
    from matplotlib import rcParams
    import numpy.random
    from mplchaco import mpl2chaco
    mpldir = os.path.join(path, "mpl")
    chacodir = os.path.join(path, "chaco")
    mkdirp(mpldir)
    mkdirp(chacodir)

    # like IPython inline plot
    rcParams.update({
        'figure.figsize': (6.0, 4.0),
        'font.size': 10,
        'savefig.dpi': 72,
        'figure.subplot.bottom': 0.125,
    })
    numpy.random.seed(seed)

    imgfmt = "{{0}}.{0}".format(ext).format
    for func in demos:
        fig = func()
        cfig = mpl2chaco(fig)

        dpi = fig.get_dpi()
        width = fig.get_figwidth() * dpi
        height = fig.get_figheight() * dpi

        mplpath = imgfmt(os.path.join(mpldir, func.__name__))
        chacopath = imgfmt(os.path.join(chacodir, func.__name__))
        fig.savefig(mplpath)
        save_plot(cfig.plot, chacopath, width, height)
开发者ID:tkf,项目名称:mplchaco,代码行数:31,代码来源:demo.py


示例2: MicrOscilloscope1

def MicrOscilloscope1(SoundBoard, Rate, YLim, FreqBand, MicSens_VPa, FramesPerBuf=512, Rec=False):
    Params = {'backend': 'Qt5Agg'}
    from matplotlib import rcParams; rcParams.update(Params)
    import matplotlib.animation as animation
    from matplotlib import pyplot as plt
    
    SBInAmpF = Hdf5F.SoundCalibration(SBAmpFsFile, SoundBoard,
                                              'SBInAmpF')
    
    r = pyaudio.PyAudio()
    
    Plotting = r.open(format=pyaudio.paFloat32,
                         channels=1,
                         rate=Rate,
                         input=True,
                         output=False,
                         #input_device_index=18,
                         frames_per_buffer=FramesPerBuf)
                         #stream_callback=InCallBack)
    
    Fig = plt.figure()
    Ax = plt.axes(xlim=FreqBand, ylim=YLim)
    Plot, = Ax.plot([float('nan')]*(Rate//10), lw=1)
    
    def AnimInit():
        Data = array.array('f', [])
        Plot.set_ydata(Data)
        return Plot,
    
    def PltUp(n):
#        Data = array.array('f', Plotting.read(Rate//10))
        Data = array.array('f', Plotting.read(Rate//10, 
                                              exception_on_overflow=False))
        Data = [_ * SBInAmpF for _ in Data]
        HWindow = signal.hanning(len(Data)//(Rate/1000))
        F, PxxSp = signal.welch(Data, Rate, HWindow, nperseg=len(HWindow), noverlap=0, 
                                scaling='density')
        
        Start = np.where(F > FreqBand[0])[0][0]-1
        End = np.where(F > FreqBand[1])[0][0]-1
        BinSize = F[1] - F[0]
        RMS = sum(PxxSp[Start:End] * BinSize)**0.5
        dB = 20*(math.log(RMS/MicSens_VPa, 10)) + 94
        print(dB, max(PxxSp))
        
        Plot.set_xdata(F)
        Plot.set_ydata(PxxSp)
        return Plot,
    
    Anim = animation.FuncAnimation(Fig, PltUp, frames=FramesPerBuf, interval=16, 
                                   blit=False)
    
    if Rec:
        Writers = animation.writers['ffmpeg']
        Writer = Writers(fps=15, metadata=dict(artist='Me'))
        Anim.save('MicrOscilloscope.mp4', writer=Writer)
    
    plt.show()
        
    return(None)
开发者ID:malfatti,项目名称:SciScripts,代码行数:60,代码来源:ControlSoundBoard.py


示例3: valueOccurenceGraphInverse

def valueOccurenceGraphInverse(nameDict, height):
    valueOps = [nameDict[name].opAtHeight(height) for name in nameDict]
    values = [x.value for x in valueOps if x is not None]
    counter = collections.Counter(values)
    prevCount = 0
    maxValues = len(values)
    total = len(values)
    xData = []
    yData = []

    for value, count in reversed(counter.most_common()):
        if count > prevCount:
            xData.append(prevCount)
            yData.append(total/maxValues)
            for i in range(prevCount + 1, count):
                xData.append(i)
                yData.append(total/maxValues)
        total -= count
        prevCount = count
    xData.append(count)
    yData.append(total)
    
    ax = plt.subplot(111)
    plt.plot(xData, yData)
    ax.set_xlim([-300,20000])
    formatter = FuncFormatter(to_percent)
    plt.gca().yaxis.set_major_formatter(formatter)


    plt.xlabel(r"\textbf{Value occurs more than n times}")
    plt.ylabel(r"\textbf{Percent of total names}")
    rc('font', serif='Helvetica Neue') 
    rc('text', usetex='true') 
    rcParams.update({'font.size': 16})
    rcParams.update({'figure.autolayout': True})
开发者ID:Aranjedeath,项目名称:namecoin-analysis,代码行数:35,代码来源:nameHistory.py


示例4: imshow_wrapper

def imshow_wrapper(H, title=None, fname=None, size=(2.2, 2.2), adjust=0.):
    fig = plt.figure()
    ax = fig.add_subplot(111)
    font = {'family' : 'normal',
            'weight' : 'bold',
            'size'   : 8}
    matplotlib.rc('font', **font)
    rcParams.update({'figure.autolayout': True})
    
    plt.imshow(H, cmap=cm.Greys)
    plt.colorbar()
    plt.xlabel('column index')
    plt.ylabel('row index')
    if title == None:
        plt.title('Entries of H')
    else:
        plt.title(title)
    xticks = ax.xaxis.get_major_ticks()
    xticks[-1].label1.set_visible(False)
    yticks = ax.yaxis.get_major_ticks()
    yticks[-1].label1.set_visible(False)
    F = plt.gcf()
    F.subplots_adjust(left=adjust)
    plt.show()
    F.set_size_inches(size)
    if fname != None:
        fig.savefig(fname + '.eps')
开发者ID:appcoreopc,项目名称:mrnmf,代码行数:27,代码来源:NMF_algs.py


示例5: plotV

def plotV(Sall):
    params = {
        'axes.labelsize': 10,
        'font.size': 10,
        'legend.fontsize': 10,
        'xtick.labelsize': 10,
        'ytick.labelsize': 10,
        'text.usetex': False,
        'figure.figsize': [3.8, 3.8],
    }
    rcParams.update(params)
    for i in range(Sall.secNum):
        h1, = plot(Sall.S[i], Sall.V[i]*3.6, color="black", linewidth=1) #, label=u'速度曲线'
        h2, = plot(Sall.S[i], [Sall.secLimit[i]*3.6]*len(Sall.S[i]), color="black", linewidth=1, linestyle="--")
    
    ylim(0.0,100.0)
    xlim(12100, 13600)
    gca().invert_xaxis()
    xlabel('公里标(m)')
    ylabel('速度(m/s)')
    h1._label = "速度曲线"
    h2._label = "速度限制"
    legend(loc='upper right')
    savefig("S6.pdf", dpi=600)
    show()
开发者ID:Scicomath,项目名称:gmcm,代码行数:25,代码来源:plotScript.py


示例6: draw_bar

def draw_bar(means, density):
    from matplotlib import rcParams
    rcParams.update({'figure.autolayout': True})

    ind = np.arange(len(means))  # the x locations for the groups
    width = 0.35       # the width of the bars

    fig, ax = plt.subplots()
    rects = ax.bar(ind, means, width, color='g')

    # add some text for labels, title and axes ticks
    ax.set_ylabel('Milliseconds')
    ax.set_title('Average running time on %s networks' % density)
    ax.set_xticks(ind+width)
    ax.set_xticklabels(('Ford-Fulkerson', 'Edmonds-Karp', 'Capacity scaling', 'Generic push relabel', 'Relabel to front'),
                       rotation=40, ha='right', fontsize=10)

    def autolabel(rects):
        # attach some text labels
        for i, rect in enumerate(rects):
            height = rect.get_height()
            ax.text(rect.get_x()+rect.get_width()/2., height + 0.05, '%d' % means[i],
                    ha='center', va='bottom')

    autolabel(rects)

    plt.savefig(util.get_out_file('chart', '%s.png' % density))
开发者ID:JovanCe,项目名称:mfp,代码行数:27,代码来源:bar_chart.py


示例7: myScatter

def myScatter(lst,xtxt="",ytxt="",f="out.pdf"):
  import matplotlib
  import matplotlib.pyplot as plt
  from matplotlib.backends.backend_agg \
       import FigureCanvasAgg as FigureCanvas
  from matplotlib.figure import Figure
  import numpy
  from matplotlib import rcParams
  rcParams.update({'figure.autolayout': True})
  asnum  = numpy.array
  x,y    = asnum([z[0] for z in lst]), \
            asnum([z[1] for z in lst])
  fig    = Figure(figsize=(4,2))
  canvas = FigureCanvas(fig)
  ax     = fig.add_subplot(111)
  ax.set_xlabel(xtxt,fontsize=9)
  ax.set_ylabel(ytxt,fontsize=9)
  ax.grid(True,linestyle='-',color='0.75')
  ax.set_ylim((-2,102))
  cm = plt.cm.get_cmap('RdYlGn')
  plt.ylim(-5,100)
  ax.plot(x,y,marker='o', linestyle='--', color='r', label='Square')
  ax.tick_params(axis='both', which='major', labelsize=9)
  ax.tick_params(axis='both', which='minor', labelsize=9)
  print(f)
  canvas.print_figure(f,dpi=500)
开发者ID:ai-se,项目名称:leaner,代码行数:26,代码来源:learn.py


示例8: plot_TS

def plot_TS(temp, psal, depth, lon, lat, svec, tvec, density, title, m, figname):
    '''
    Create the T-S diagram
    '''
    logger = logging.getLogger(__name__)
    fig = plt.figure(figsize=(15, 15))
    rcParams.update({'font.size': 18})
    plt.scatter(psal, temp, s=5, c=depth, vmin=10., vmax=1000.,
               edgecolor='None', cmap=plt.cm.plasma)
    cbar = plt.colorbar(extend='max')
    plt.xlabel('Salinity', fontsize=18)
    plt.ylabel('Temperature\n($^{\circ}$C)', rotation=0, ha='right', fontsize=18)
    cont = plt.contour(svec, tvec, density, levels=np.arange(22., 32., 1.), 
                       colors='.65', linestyles='dashed', lineswidth=0.5)
    plt.clabel(cont,inline=True, fmt='%1.1f')
    plt.xlim(smin, smax)
    plt.ylim(tmin, tmax)
    cbar.set_label('Depth\n(m)', rotation=0, ha='left')
    plt.grid(color="0.6")

    # Add an inset showing the positions of the platform
    inset=plt.axes([0.135, 0.625, 0.3, 0.35])
    lon2plot, lat2plot = m(lon, lat)
    m.drawmapboundary(color='w')
    m.plot(lon2plot, lat2plot, 'ro', ms=2, markeredgecolor='r')
    #m.drawcoastlines(linewidth=0.25)
    m.drawlsmask(land_color='0.4', ocean_color='0.9', lakes=False)
    plt.title(title, fontsize=20)
    plt.savefig(figname, dpi=150)
    # plt.show()
    plt.close()
开发者ID:ctroupin,项目名称:CMEMS_INSTAC_Training,代码行数:31,代码来源:plot_TS_diagram_all.py


示例9: rcParams

    def rcParams(self):
        """
        Return rcParams dict for this theme.

        Notes
        -----
        Subclasses should not need to override this method method as long as
        self._rcParams is constructed properly.

        rcParams are used during plotting. Sometimes the same theme can be
        achieved by setting rcParams before plotting or a apply
        after plotting. The choice of how to implement it is is a matter of
        convenience in that case.

        There are certain things can only be themed after plotting. There
        may not be an rcParam to control the theme or the act of plotting
        may cause an entity to come into existence before it can be themed.

        """

        try:
            rcParams = deepcopy(self._rcParams)
        except NotImplementedError:
            # deepcopy raises an error for objects that are drived from or
            # composed of matplotlib.transform.TransformNode.
            # Not desirable, but probably requires upstream fix.
            # In particular, XKCD uses matplotlib.patheffects.withStrok
            rcParams = copy(self._rcParams)

        for th in self.themeables.values():
            rcParams.update(th.rcParams)
        return rcParams
开发者ID:jwhendy,项目名称:plotnine,代码行数:32,代码来源:theme.py


示例10: config_plot

    def config_plot(self, arg_list):
        """Configure global plot parameters"""
        import matplotlib
        from matplotlib import rcParams

        # set rcParams
        rcParams.update({
            'figure.dpi': 100.,
            'font.family': 'sans-serif',
            'font.size': 16.,
            'font.weight': 'book',
            'legend.loc': 'best',
            'lines.linewidth': 1.5,
            'text.usetex': 'true',
            'agg.path.chunksize': 10000,
        })

        # determine image dimensions (geometry)
        self.width = 1200
        self.height = 768
        if arg_list.geometry:
            try:
                self.width, self.height = map(float,
                                              arg_list.geometry.split('x', 1))
                self.height = max(self.height, 500)
            except (TypeError, ValueError) as e:
                e.args = ('Cannot parse --geometry as WxH, e.g. 1200x600',)
                raise

        self.dpi = rcParams['figure.dpi']
        self.xinch = self.width / self.dpi
        self.yinch = self.height / self.dpi
        rcParams['figure.figsize'] = (self.xinch, self.yinch)
        return
开发者ID:WanduiAlbert,项目名称:gwpy,代码行数:34,代码来源:cliproduct.py


示例11: setFigForm

def setFigForm():
    """set the rcparams to EmulateApJ columnwidth=245.26 pts """

    fig_width_pt = 245.26 * 2
    inches_per_pt = 1.0 / 72.27
    golden_mean = (math.sqrt(5.0) - 1.0) / 2.0
    fig_width = fig_width_pt * inches_per_pt
    fig_height = fig_width * golden_mean
    fig_size = [1.5 * fig_width, fig_height]

    params = {
        "backend": "ps",
        "axes.labelsize": 12,
        "text.fontsize": 12,
        "legend.fontsize": 7,
        "xtick.labelsize": 11,
        "ytick.labelsize": 11,
        "text.usetex": True,
        "font.family": "serif",
        "font.serif": "Times",
        "image.aspect": "auto",
        "figure.subplot.left": 0.1,
        "figure.subplot.bottom": 0.1,
        "figure.subplot.hspace": 0.25,
        "figure.figsize": fig_size,
    }

    rcParams.update(params)
开发者ID:OSSOS,项目名称:MOP,代码行数:28,代码来源:figures.py


示例12: make_boxplot_temperature

def make_boxplot_temperature(caObj, name, modis_lvl2=False):
    low_clouds = get_calipso_low_clouds(caObj)
    high_clouds = get_calipso_high_clouds(caObj)
    medium_clouds = get_calipso_medium_clouds(caObj)
    temp_c = caObj.calipso.all_arrays['layer_top_temperature'][:,0] +273.15 
    if modis_lvl2:
        temp_pps = caObj.modis.all_arrays['temperature']
    else:
        temp_pps = caObj.imager.all_arrays['ctth_temperature']  
    if modis_lvl2:
        height_pps = caObj.modis.all_arrays['height']
    else:
        height_pps = caObj.imager.all_arrays['ctth_height']

    thin = np.logical_and(caObj.calipso.all_arrays['feature_optical_depth_532_top_layer_5km']<0.30, 
                          caObj.calipso.all_arrays['feature_optical_depth_532_top_layer_5km']>0) 
    very_thin = np.logical_and(caObj.calipso.all_arrays['feature_optical_depth_532_top_layer_5km']<0.10, 
                          caObj.calipso.all_arrays['feature_optical_depth_532_top_layer_5km']>0) 
    thin_top = np.logical_and(caObj.calipso.all_arrays['number_layers_found']>1, thin)
    thin_1_lay = np.logical_and(caObj.calipso.all_arrays['number_layers_found']==1, thin)
    use = np.logical_and(temp_pps >100,
                         caObj.calipso.all_arrays['layer_top_altitude'][:,0]>=0)
    use = np.logical_and(height_pps <45000,use)
    low = np.logical_and(low_clouds,use)
    medium = np.logical_and(medium_clouds,use)
    high = np.logical_and(high_clouds,use)
    c_all = np.logical_or(high,np.logical_or(low,medium))
    high_very_thin = np.logical_and(high, very_thin)
    high_thin = np.logical_and(high, np.logical_and(~very_thin,thin))
    high_thick = np.logical_and(high, ~thin)
    #print "thin, thick high", np.sum(high_thin), np.sum(high_thick) 
    bias = temp_pps - temp_c
    abias = np.abs(bias)
    #abias[abias>2000]=2000
    print name.ljust(30, " "), "%3.1f"%(np.mean(abias[c_all])), "%3.1f"%(np.mean(abias[low])),"%3.1f"%(np.mean(abias[medium])),"%3.1f"%(np.mean(abias[high]))

    c_all = np.logical_or(np.logical_and(~very_thin,high),np.logical_or(low,medium))
    number_of = np.sum(c_all)
     
    #print name.ljust(30, " "), "%3.1f"%(np.sum(abias[c_all]<250)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<500)*100.0/number_of),  "%3.1f"%(np.sum(abias[c_all]<1000)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<1500)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<2000)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<3000)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<4000)*100.0/number_of), "%3.1f"%(np.sum(abias[c_all]<5000)*100.0/number_of)
    from matplotlib import rcParams
    rcParams.update({'figure.autolayout': True})
    fig = plt.figure(figsize = (6,9))        
    ax = fig.add_subplot(111)
    plt.xticks(rotation=70)
    ax.fill_between(np.arange(0,8),-2.5,2.5, facecolor='green', alpha=0.6)
    ax.fill_between(np.arange(0,8),-5,5, facecolor='green', alpha=0.4)
    ax.fill_between(np.arange(0,8),-7.5,7.5, facecolor='green', alpha=0.2)
    ax.fill_between(np.arange(0,8),10,150, facecolor='red', alpha=0.2)
    ax.fill_between(np.arange(0,8),-20,-10, facecolor='red', alpha=0.2)
    for y_val in [-5,-4,-3,-2,-1,1,2,3,4,5]:
        plt.plot(np.arange(0,8), y_val*20 + 0*np.arange(0,8),':k', alpha=0.4)
    plt.plot(np.arange(0,8), 0 + 0*np.arange(0,8),':k', alpha=0.4)
    bplot = ax.boxplot([bias[low],bias[medium],bias[high],bias[high_thick],bias[high_thin],bias[high_very_thin]],whis=[5, 95],sym='',
                labels=["low","medium","high-all","high-thick\n od>0.4","high-thin \n 0.1<od<0.4","high-vthin\n od<0.1"],showmeans=True, patch_artist=True)
    ax.set_ylim(-20,100)
    for box in bplot['boxes']:
        box.set_facecolor('0.9')
    plt.title(name)
    plt.savefig(ADIR + "/PICTURES_FROM_PYTHON/CTTH_BOX/ctth_box_plot_temperature_%s_5_95_filt.png"%(name))
开发者ID:adybbroe,项目名称:atrain_match,代码行数:60,代码来源:plot_ctth_boxplots_mlvl2_temperature_pressure_height.py


示例13: __init__

	def __init__(self, parent):
		gui.MainFrame.__init__(self, parent)
		self.summaryFiles = []
		self.activeSummaryFiles = []
		self.testedAssemblers = []
		self.summaryParsers = []
		self.summaryLabels = []
		self.covData = {}
		self.covDataKeys = []
		self.covDataValues = []
		self.plotIndex = 0
		self.plotDir = ''
		self.newEntry = ''
		self.xAttribute = 'l'
		self.yAttribute = 'cN50'
		self.xUnits = 'bp'
		self.yUnits = 'bp'
		self.xScale = 'linear'
		self.yScale = 'linear'
		self.readFile = ''
		self.referencePickerName = ''
		self.contigPickerName = ''
		self.deBrujinAssemblers = ['abyss','ray','soap','velvet']
		self.deBrujin = ('ABySS assembler', 'SOAPdenovo2', 'Velvet', 'Ray assembler')
		self.styles = []
		rcParams.update({'figure.autolayout': True})
		self.atributes = ['l', 'cov', 'N', 'd', 'e', 'r', 'R', 'X', 'A', 'D']
		self.units = ['bp', 'coverage', 'num reads', '', '', '', '', '', '', '']
		self.detailsDict = {'cTotalNum':'(number of contigs)', 'cBiggerThen':'(num. of contigs bigger then s)',
							'cTotalLen' : '(total length of contigs)', 'cMaxLen' : '(maximum length of contigs)',
							'cMinLen' : '(minimum length of contigs)', 'cAvgLen' : '(average length of contigs)',
							'cMedLen' : '(median length of contigs)', 'cN50':'(N50 size of contigs)',
							'cN25':'(N25 size of contigs)', 'cN75':'(N75 size of contigs)', 'cN56':'(N56 size of contigs)',
							'sTotalNum':'(number of scaffolds)', 'sBiggerThen':'(num. of scaffolds bigger then s)',
							'sTotalLen' : '(total length of scaffolds)','sMaxSize' : '(maximum length of scaff.)',
							'sMinSize' : '(minimum length of scaff.','sAvgLen' : '(average length of scaff.)',
							'sMedSize' : '(median length of scaff.)', 'sN50':'(N50 size of scaffolds)',
							'sN25':'(N25 size of scaffolds)','sN56':'(N56 size of scaffolds)',
							'sN75':'(N75 size of scaffolds)','sEM':'(ratio between median and E-size[scaff.])',
							'sEN':'(ratio between n50 and E-size)','mAvgs':'(average length of scaff./average length of cont.)',
							'mN50s':'(N50[contigs]/N50[scaffolds])','mNums':'([number of contigs]/[number of scaffolds])',
							'mLens':'([total len. of cont.]/[total len. of scaff.])', 'mMaxs':'([max length of con.]/[max length of scaff.])',
							'totalRealTime':'(total execution time of all steps of the assembly process)',
							'totalCpuTime':'(total CPU time of all steps of the assembly process)',
							'totalRSS':'(peak memory usage [Resident Set Size])',
							'l':'(read length)',
							}
		self.atributes += ['totalRealTime', 'totalCpuTime', 'totalRSS', 'totalPSS', 'totalVmSize', 'cTotalNum', 'cBiggerThen', \
						   'cTotalLen', 'cMaxLen', 'cMinLen', 'cAvgLen', 'cMedLen', 'cESize', 'cN25', 'cN50', 'cN56', 'cN75', 'sTotalNum', \
						   'sMaxSize', 'sMinSize', 'sAvgSize', 'sMedSize', 'sCertainNum', 'sN25', 'sN50', 'sN56', 'sN75', 'sEM', 'sEN', 'sQual', 'mAvgs', 'mN50s', 'mNums', 'mLens', 'mMaxs','cReferenceCoverage']
		self.units += ['sec', 'sec', 'MB', 'MB', 'MB', '', '', \
					   'bp', 'bp', 'bp', 'bp', 'bp', '', 'bp', 'bp', 'bp', 'bp', '', \
					   'bp', 'bp', 'bp', 'bp', '', 'bp', 'bp', 'bp', 'bp', '', '', \
					   '', '', '', '', '', '',''];
		self.selectionMap = {0:'linear',1:'logarithmic'}
		self.checkListBoxInitialItems = {"abyss":0,"minimus":1,"sga":2,"pasqual":3,"soap":4,"celera":5,"velvet":6,"readjoiner":7, "ray":8}
		self.assemblerTypes = {}
		print "[AN:] Basic viewer 1.0 started at: ", time.strftime("%H:%M:%S")
		self.CreatePlot()
		self.createReadsPlot()
开发者ID:vzupanovic,项目名称:skripte,代码行数:60,代码来源:benchmarkGUI.py


示例14: temporal_analysis

def temporal_analysis():
    words = ["sorto", u"ryssä", "nais", "torppar", u"työttömy", "nykyi", "histor", "jumala", "kirkko", "jeesus", u"marx", u"sosialis", u"porwari", u"työ", u"työttömyy", u"työläi", u"työvä", u"kapitalis", u"taantu", u"taistel", u"toveri", u"vallankumou", "torppari", "agitaattori", u"köyhälistö", u"kärsi", "orja", "sort", "sosialidemokraatti", "lakko", "vapau", "voitto"]
    ts, soc_freqs, other_freqs = frequency_over_time(words)
    print 100000 * soc_freqs
    print 100000 * other_freqs
    from matplotlib import rcParams
    rcParams.update({'figure.autolayout': True})
    for i, word in enumerate(words):
        plt.figure(1)
        plt.clf()
        plt.plot(ts[:-1], soc_freqs[:,i], '-x')
        plt.plot(ts[:-1], other_freqs[:,i], '-o')
        max_y = max(np.max(soc_freqs[:,i]), np.max(other_freqs[:,i]))
        plt.ylim((0, max_y*1.05))
        plt.xlabel('Year')
        plt.ylabel('Frequency')
        plt.title(word)
        plt.legend(['Socialist', 'Others'], loc='best')
        plt.savefig('../plots/%s.png' % word)
        date_str = re.sub(" ", "T", str(dt.datetime.now()))[:-7]
        date_str = re.sub(":", "", date_str)
    pickle.dump((ts,soc_freqs,other_freqs,words), open('../plot_data/%s.pckl' % date_str, 'wb'))
    save_csv2(words, soc_freqs, ts, "socialist")
    save_csv2(words, other_freqs, ts, "others")
    save_csv(words, soc_freqs, "socialist")
    save_csv(words, other_freqs, "others")
开发者ID:dhh15,项目名称:fnewspapers,代码行数:26,代码来源:word_frequencies.py


示例15: pdf

def pdf(params={}, presentation='powerpoint'):

    if presentation == 'powerpoint':
        fontsize = 14
        figsize = (10,7.5)
        subplot_left = 0.15
        subplot_right = 0.85
        subplot_top = 0.8
        subplot_bottom = 0.15
        
    if presentation == 'paper':
        fontsize = 8
        figsize = (8,8)
        subplot_left = 0.2
        subplot_right = 0.8
        subplot_top = 0.8
        subplot_bottom = 0.2

    print 'Loading rcparams for saving to PDF'
    print 'NOTE: ipython plotting may not work as expected with these parameters loaded!'
    default_params = {'backend': 'Agg',
                      'ps.usedistiller': 'xpdf',
                      'ps.fonttype' : 3,
                      'pdf.fonttype' : 3,
                      'font.family' : 'sans-serif',
                      'font.serif' : 'Times, Palatino, New Century Schoolbook, Bookman, Computer Modern Roman',
                      'font.sans-serif' : 'Helvetica, Avant Garde, Computer Modern Sans serif',
                      'font.cursive' : 'Zapf Chancery',
                      'font.monospace' : 'Courier, Computer Modern Typewriter',
                      'font.size' : fontsize,
                      'text.fontsize': fontsize,
                      'axes.labelsize': fontsize,
                      'axes.linewidth': 1.0,
                      'xtick.major.linewidth': 1,
                      'xtick.minor.linewidth': 1,
                      #'xtick.major.size': 6,
                      #'xtick.minor.size' : 3,
                      'xtick.labelsize': fontsize,
                      #'ytick.major.size': 6,
                      #'ytick.minor.size' : 3,
                      'ytick.labelsize': fontsize,
                      'figure.figsize': figsize,
                      'figure.dpi' : 72,
                      'figure.facecolor' : 'white',
                      'figure.edgecolor' : 'white',
                      'savefig.dpi' : 300,
                      'savefig.facecolor' : 'white',
                      'savefig.edgecolor' : 'white',
                      'figure.subplot.left': subplot_left,
                      'figure.subplot.right': subplot_right,
                      'figure.subplot.bottom': subplot_bottom,
                      'figure.subplot.top': subplot_top,
                      'figure.subplot.wspace': 0.2,
                      'figure.subplot.hspace': 0.2,
                      'lines.linewidth': 1.0,
                      'text.usetex': True, 
                      }
    for key, val in params.items():
        default_params[key] = val
    rcParams.update(default_params) 
开发者ID:alexlib,项目名称:FlyPlotLib,代码行数:60,代码来源:set_params.py


示例16: test_configure_mpl

def test_configure_mpl():
    plot.configure_mpl()
    assert os.environ['HOME'] == os.environ['MPLCONFIGDIR']
    assert rcParams['ps.useafm'] is True
    assert rcParams['pdf.use14corefonts'] is True
    assert rcParams['text.usetex'] is True
    rcParams.update(rcParamsDefault)
开发者ID:andrew-lundgren,项目名称:gwdetchar,代码行数:7,代码来源:test_plot.py


示例17: plot_shaded_lines

def plot_shaded_lines(my_xticks, y1, y2, error1, error2, ylab, xlab, filename):
    plt.figure(figsize=(6,6))
    from matplotlib import rcParams
    rcParams.update({'figure.autolayout': True})

    x = range(0, len(y1))
    plt.plot(x, y1, 'k-', color="blue",  label='men')
    plt.fill_between(x, y1-error1, y1+error1, facecolor='blue', alpha=.2)

    plt.plot(x, y2, 'k-', color="red",  label='women')
    plt.fill_between(x, y2-error2, y2+error2, facecolor='red', alpha=.2)

    #if isinstance(x, (int, long, float, complex)):
    #    plt.xlim(np.min(x), np.max(x))
    plt.gcf().subplots_adjust(bottom=0.3)

    plt.xticks(x, my_xticks)
    plt.xticks(rotation=70, fontsize=14)
    plt.yticks(fontsize=14)
    #plt.setp(ax.get_xticklabels(), rotation='vertical', fontsize=14)
    plt.ylabel(ylab, fontsize=14)
    plt.xlabel(xlab, fontsize=14)
    plt.legend()

    plt.savefig(filename)
开发者ID:clauwag,项目名称:WikipediaGenderInequality,代码行数:25,代码来源:util.py


示例18: graph

def graph(csv_file, filename, bytes2str):
    '''Create a line graph from a two column csv file.'''

    unit = configs['unit']
    date, value = np.loadtxt(csv_file, delimiter=',', unpack=True,
                             converters={0: bytes2str}
                             )
    fig = plt.figure(figsize=(10, 3.5))
    fig.add_subplot(111, axisbg='white', frameon=False)
    rcParams.update({'font.size': 9})
    plt.plot_date(x=date, y=value, ls='solid', linewidth=2, color='#FB921D',
                  fmt=':'
                  )
    title = "Sump Pit Water Level {}".format(time.strftime('%Y-%m-%d %H:%M'))
    title_set = plt.title(title)
    title_set.set_y(1.09)
    plt.subplots_adjust(top=0.86)

    if unit == 'imperial':
        plt.ylabel('inches')
    if unit == 'metric':
        plt.ylabel('centimeters')

    plt.xlabel('Time of Day')
    plt.xticks(rotation=30)
    plt.grid(True, color='#ECE5DE', linestyle='solid')
    plt.tick_params(axis='x', bottom='off', top='off')
    plt.tick_params(axis='y', left='off', right='off')
    plt.savefig(filename, dpi=72)
开发者ID:Howlinmoon,项目名称:raspi-sump,代码行数:29,代码来源:todaychart.py


示例19: plotY1Y2

def plotY1Y2(points,
             title="Estimate vs. Workers",
             xaxis="# Workers",
             yaxis="Estimate",
             legend=[],
             filename="output.png"):

    import matplotlib.pyplot as plt
    from matplotlib import font_manager, rcParams
    rcParams.update({'figure.autolayout': True})
    rcParams.update({'font.size': 16})
    fprop = font_manager.FontProperties(fname= 
        '/Library/Fonts/Microsoft/Gill Sans MT.ttf') 

    num_estimators = len(points[1][0])

    plt.figure() 
    colors = ['#00ff99','#0099ff','#ffcc00','#ff5050']

    for i in range(0,num_estimators):
        res = [j[i] for j in points[1]]
        plt.plot(points[0], res, 's-', linewidth=2.5,markersize=7,color=colors[i])

    #plt.plot(points[0], points[2], 'o-', linewidth=2.5,markersize=5,color='#FF6666')
    plt.plot(points[0], points[2], '--', linewidth=2.5,color='#333333')
    plt.title(title,fontproperties=fprop)
    plt.xlabel(xaxis,fontproperties=fprop)
    plt.ylabel(yaxis,fontproperties=fprop)
    plt.ylim(ymin=0) 
    plt.xlim(xmin=points[0][0], xmax=points[0][len(points[0])-1]) 
    plt.legend(legend,loc='lower right')
    plt.grid(True)
    plt.savefig(filename,bbox_inches='tight')
开发者ID:sjyk,项目名称:datacleaningunknowns,代码行数:33,代码来源:simulator_new.py


示例20: test_colorbar_extension_shape

def test_colorbar_extension_shape():
    '''Test rectangular colorbar extensions.'''
    # Use default params so matplotlibrc doesn't cause the test to fail.
    rcParams.update(rcParamsDefault)
    # Create figures for uniform and proportionally spaced colorbars.
    fig1 = _colorbar_extension_shape('uniform')
    fig2 = _colorbar_extension_shape('proportional')
开发者ID:AdamHeck,项目名称:matplotlib,代码行数:7,代码来源:test_colorbar.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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