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


Python pyplot.getp函数代码示例

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


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

示例1: plotStreamLine

def plotStreamLine(x,y,U,V,nIter):
   pltFile = 'streamLine_%5.5d.png' % int(nIter)
   x = np.asarray(x)
   y = np.asarray(y)
   U = np.swapaxes(U,1,0)
   V = np.swapaxes(V,1,0)

   strm = plt.streamplot(x,y,U,V, color='k', density=1, linewidth=1)

   plt.axis([x.min(), x.max(), y.min(), y.max()])
   plt.xscale('linear')
   plt.yscale('linear')
   plt.xlabel('x [m]', fontsize=18)
   plt.ylabel('y [m]', fontsize=18)
   plt.grid(True)
   ax = plt.gca()
   xlabels = plt.getp(ax, 'xticklabels')
   ylabels = plt.getp(ax, 'yticklabels')
   plt.setp(xlabels, fontsize=10)
   plt.setp(ylabels, fontsize=10)

   fig = plt.gcf()
   fig.set_size_inches(5,6)
   plt.tight_layout()
   plt.savefig(pltFile, format='png')
   plt.close()

   print "%s DONE!!" % (pltFile)
   plt.show()
开发者ID:sayop,项目名称:CFM03,代码行数:29,代码来源:post.py

示例2: plot_counts

def plot_counts(ax, dictorigin, x_locator, x_formatter, bin_edges_in, snum, enum):
    # compute all data needed
    time = dictorigin["time"]
    cumcounts = np.arange(1, np.alen(time) + 1)
    if len(bin_edges_in) < 2:
        return
    binsize = bin_edges_in[1] - bin_edges_in[0]
    binsize_str = binsizelabel(binsize)

    # plot
    counts, bin_edges_out, patches = ax.hist(
        time, bin_edges_in, cumulative=False, histtype="bar", color="black", edgecolor=None
    )
    ax.grid(True)
    ax.xaxis_date()
    plt.setp(ax.get_xticklabels(), rotation=90, horizontalalignment="center", fontsize=7)
    ax.set_ylabel("# Earthquakes\n%s" % binsize_str, fontsize=8)
    ax.xaxis.set_major_locator(x_locator)
    ax.xaxis.set_major_formatter(x_formatter)
    if snum and enum:
        ax.set_xlim(snum, enum)

    ax2 = ax.twinx()
    p2, = ax2.plot(time, cumcounts, "g", lw=2.5)
    ax2.yaxis.get_label().set_color(p2.get_color())
    ytl_obj = plt.getp(ax2, "yticklabels")  # get the properties for yticklabels
    # plt.getp(ytl_obj)                       # print out a list of properties
    plt.setp(ytl_obj, color="g")  # set the color of yticks to red
    plt.setp(plt.getp(ax2, "yticklabels"), color="g")  # xticklabels: same
    ax2.set_ylabel("Cumulative\n# Earthquakes", fontsize=8)
    ax2.xaxis.set_major_locator(x_locator)
    ax2.xaxis.set_major_formatter(x_formatter)
    if snum and enum:
        ax2.set_xlim(snum, enum)
    return
开发者ID:gthompson,项目名称:python_gt,代码行数:35,代码来源:modgiseis.py

示例3: plotTempContour

def plotTempContour(x,y,T,nIter):
   from matplotlib import mlab, cm
   cmap = cm.PRGn

   pltFile = 'contour_Temp_%5.5d.png' % int(nIter)
   x = np.asarray(x)
   y = np.asarray(y)

   phiMin = T.min()
   phiMax = T.max()

   plt.imshow(T, vmin=phiMin, vmax=phiMax, extent=[x.min(), x.max(), y.min(), y.max()])
   plt.colorbar()

   plt.xscale('linear')
   plt.yscale('linear')
   plt.xlabel('x', fontsize=18)
   plt.ylabel('y', fontsize=18)
   #plt.grid(True)
   ax = plt.gca()
   xlabels = plt.getp(ax, 'xticklabels')
   ylabels = plt.getp(ax, 'yticklabels')
   plt.setp(xlabels, fontsize=15)
   plt.setp(ylabels, fontsize=15)

   fig = plt.gcf()
   fig.set_size_inches(9,5)
   plt.tight_layout()
   plt.savefig(pltFile, format='png')
   plt.close()

   print "%s DONE!!" % (pltFile)
   plt.show()
开发者ID:sayop,项目名称:CFM-Final,代码行数:33,代码来源:post.py

示例4: insax

def insax(ax, i, j, h, w, **kwargs):
    """
    Axes spanning upper left spij(m,n,i,j) to lower right spij(m,n,i+h-1,j+w-1).
    
    ax is a (nrow, ncol) array of Axes.
    
    Example (using a new figure to avoid interference with any existing figure 
    objects).
    
    >>> fig = plt.figure()
    >>> ax = np.array([plt.subplot(4, 4, i) for i in range(1, 17)], 
    ...     object).reshape(4, 4)
    >>> pos = getp(insax(ax, 1, 1, 2, 2), "position")
    >>> print str(pos).replace("'", "")
    Bbox(array([[ 0.32717391,  0.30869565],...[ 0.69782609,  0.69130435]]))
    """
    (left, _), (_, top) = getp(ax[i, j], "position").get_points()
    (_, bottom), (right, _) = getp(ax[i+h-1, j+w-1], "position").get_points()
    # (left, _), (_, top) = getp(spij(m, n, i, j), "position").get_points()
    # (_, bottom), (right, _) = getp(
    #     spij(m, n, i+h, j+w), "position").get_points()
    width = right - left
    height = top - bottom
    ax = plt.gcf().add_axes([left, bottom, width, height], **kwargs)
    return ax
开发者ID:argju,项目名称:cgptoolbox,代码行数:25,代码来源:splom.py

示例5: fplotly

def fplotly(fig, username, api_key):
    axes = fig.axes
    lines = axes[0].lines
    xdata = plt.getp(lines[0], 'xdata')
    ydata = plt.getp(lines[0], 'ydata')
    py = plotly.plotly(username, api_key)
    py.plot(xdata,ydata)
开发者ID:theengineear,项目名称:wrapper,代码行数:7,代码来源:plot_sin.py

示例6: plotContour

def plotContour(x,y,phi,pltFile):
   xi, yi = np.meshgrid(x, y)
   zi = phi

   plt.imshow(zi, vmin=zi.min(), vmax=0.075, origin='lower', extent=[x.min(), x.max(), y.min(), y.max()])
   plt.colorbar()

   plt.xscale('linear')
   plt.yscale('linear')
   plt.xlabel('x', fontsize=18)
   plt.ylabel('y', fontsize=18)
   plt.grid(True)
   ax = plt.gca()
   xlabels = plt.getp(ax, 'xticklabels')
   ylabels = plt.getp(ax, 'yticklabels')
   plt.setp(xlabels, fontsize=15)
   plt.setp(ylabels, fontsize=15)

   fig = plt.gcf()
   fig.set_size_inches(6,5)
   plt.tight_layout()
   plt.savefig(pltFile, format='png')
   plt.close()

   print "%s DONE!!" % (pltFile)
   plt.show()
开发者ID:sayop,项目名称:CFM01,代码行数:26,代码来源:post.py

示例7: plot_energy

def plot_energy(ax, dictorigin, x_locator, x_formatter, bin_edges, snum, enum):

    # compute all data needed
    time = dictorigin["time"]
    energy = ml2energy(dictorigin["ml"])
    cumenergy = np.cumsum(energy)
    binned_energy = bin_irregular(time, energy, bin_edges)
    if len(bin_edges) < 2:
        return
    barwidth = bin_edges[1:] - bin_edges[0:-1]
    binsize = bin_edges[1] - bin_edges[0]
    binsize_str = binsizelabel(binsize)

    # plot
    ax.bar(bin_edges[:-1], binned_energy, width=barwidth, color="black", edgecolor=None)

    # re-label the y-axis in terms of equivalent Ml rather than energy
    yticklocs1 = ax.get_yticks()
    ytickvalues1 = np.log10(yticklocs1) / 1.5
    yticklabels1 = list()
    for count in range(len(ytickvalues1)):
        yticklabels1.append("%.2f" % ytickvalues1[count])
    ax.set_yticks(yticklocs1)
    ax.set_yticklabels(yticklabels1)

    ax.grid(True)
    ax.xaxis_date()
    plt.setp(ax.get_xticklabels(), rotation=90, horizontalalignment="center", fontsize=7)
    ax.set_ylabel("Energy %s\n(unit: Ml)" % binsize_str, fontsize=8)
    ax.xaxis.set_major_locator(x_locator)
    ax.xaxis.set_major_formatter(x_formatter)
    if snum and enum:
        ax.set_xlim(snum, enum)

    # Now add the cumulative energy plot - again with yticklabels as magnitudes
    ax2 = ax.twinx()
    p2, = ax2.plot(time, cumenergy, "g", lw=2.5)

    # use the same ytick locations as for the left-hand axis, but label them in terms of equivalent cumulative magnitude
    yticklocs1 = ax.get_yticks()
    yticklocs2 = (yticklocs1 / max(ax.get_ylim())) * max(ax2.get_ylim())
    ytickvalues2 = np.log10(yticklocs2) / 1.5
    yticklabels2 = list()
    for count in range(len(ytickvalues2)):
        yticklabels2.append("%.2f" % ytickvalues2[count])
    ax2.set_yticks(yticklocs2)
    ax2.set_yticklabels(yticklabels2)

    ax2.yaxis.get_label().set_color(p2.get_color())
    ytl_obj = plt.getp(ax2, "yticklabels")  # get the properties for yticklabels
    # plt.getp(ytl_obj)                       # print out a list of properties
    plt.setp(ytl_obj, color="g")  # set the color of yticks to red
    plt.setp(plt.getp(ax2, "yticklabels"), color="g")  # xticklabels: same
    ax2.set_ylabel("Cumulative Energy\n(unit: Ml)", fontsize=8)
    ax2.xaxis.set_major_locator(x_locator)
    ax2.xaxis.set_major_formatter(x_formatter)
    if snum and enum:
        ax2.set_xlim(snum, enum)
    return
开发者ID:gthompson,项目名称:python_gt,代码行数:59,代码来源:modgiseis.py

示例8: plot_trace

	def plot_trace(self, elec, raw = 'CAR', Params = dict()):
		"""
		plots trace for the trial duration using TrialsMTX
		INPUT:
			elec - electrode number
			raw - if to calculate from raw trace ('CAR') or from hilbert ('hilbert') - optional, default 'CAR'
			Params - dictionary of onset/offset times for trial and for baseline. (optional)
		"""
		#default Params
		if not Params: #empty dict
			print 'loading default Params'
			Params['st'] = 0		#start time point (ms)
			Params['en'] = 3000		#end time point (ms)
			Params['bl_st'] = -250	#baseline start (ms)
			Params['bl_en'] = -50	#basline end (ms)
		
		dataMTX = self.makeTrialsMTX(elec, raw, Params)

		st = int(round(Params['st'] / 1000 * self.srate))
		en = int(round(Params['en'] / 1000 * self.srate))
		bl_st = int(round(Params['bl_st'] / 1000 * self.srate))
		bl_en = int(round(Params['bl_en'] / 1000 * self.srate))
		
		x = np.arange(st, en)

		plot_tp = 250 / 1000 * self.srate #ticks every 250 ms
		cue = 500 / 1000 * self.srate
		
		f, ax = plt.subplots(1,1)
		ax.axhline(y = 0,color = 'k',linewidth=2)
		ax.axvline(x = 0,color='k',linewidth=2)
		ax.axvline(x = cue,color = 'gray',linewidth = 2)
		ax.axvline(x = cue+cue,color = 'gray',linewidth = 2)
		ax.axvspan(cue, cue+cue, facecolor='0.5', alpha=0.25,label = 'cue')

		ax.plot(x, np.mean(dataMTX,0), linewidth = 2, color = 'blue')

		ax.set_xlim(st, en)
		ax.xaxis.set_ticklabels(['0', '','500', '', '1000', '', '1500', '', '2000','','2500','', '3000'],minor=False)
		ax.xaxis.set_ticks(np.arange(st, en, plot_tp))
		ax.xaxis.set_tick_params(labelsize = 14)
		ax.yaxis.set_tick_params(labelsize=14)
		xticklabels = plt.getp(plt.gca(), 'xticklabels')
		yticklabels = plt.getp(plt.gca(), 'yticklabels')
		plt.setp(xticklabels, fontsize=14, weight='bold')
		plt.setp(yticklabels, fontsize=14, weight='bold')

		for pos in ['top','bottom','right','left']:
			ax.spines[pos].set_edgecolor('gray')
			ax.get_xaxis().tick_bottom()
			ax.get_yaxis().tick_left()

		ax.set_xlabel("time (ms)")
		ax.set_ylabel("uV")
		ax.set_title('raw trace - electrode: %i' %(elec), fontsize = 18)
		plt.show()
开发者ID:matarhaller,项目名称:Seminar,代码行数:56,代码来源:subj_globals.py

示例9: display2Dpointsets

def display2Dpointsets(A, B):
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
    ax.plot(B[:,0],B[:,1],'b+',markersize=8,mew=1)
    labels = plt.getp(plt.gca(), 'xticklabels')
    plt.setp(labels, color='k', fontweight='bold')
    labels = plt.getp(plt.gca(), 'yticklabels')
    plt.setp(labels, color='k', fontweight='bold')
    return None
开发者ID:YidiCao,项目名称:RPSR,代码行数:10,代码来源:_plotting.py

示例10: make_positivity_plot

def make_positivity_plot(nga,fileNameList,cd3ChanIndex,figName,emResults,subset='CD3',filterID=None):

    filesToPlot = fileNameList
    if len(fileNameList) > 6:
        filesToPlot = fileNameList[:6]

    fig = plt.figure()
    fontSize = 8
    pltCount = 0

    for fileName in filesToPlot:
        events = nga.get_events(fileName)
        if filterID != None:
            filterIndices = nga.get_filter_indices(fileName,filterID)
            events = events[filterIndices,:] 

        cd3Events = events[:,cd3ChanIndex]
        pltCount+=1
        if pltCount > 6:
            continue

        ax = fig.add_subplot(2,3,pltCount)
        eCDF = EmpiricalCDF(cd3Events)
        thresholdLow = eCDF.get_value(0.05)
        eventsInHist = cd3Events[np.where(cd3Events > thresholdLow)[0]]
        n, bins, patches = ax.hist(eventsInHist,18,normed=1,facecolor='gray',alpha=0.5)

        maxX1 = cd3Events.max()
        maxX2 = cd3Events.max()
        pdfX1 = np.linspace(0,maxX1,300)
        pdfY1 = stats.norm.pdf(pdfX1,emResults[fileName]['params']['mu1'], np.sqrt(emResults[fileName]['params']['sig1']))
        pdfX2 = np.linspace(0,maxX2,300)
        pdfY2 = stats.norm.pdf(pdfX2,emResults[fileName]['params']['mu2'], np.sqrt(emResults[fileName]['params']['sig2']))
        pdfY1 = pdfY1 * (1.0 - emResults[fileName]['params']['pi'])
        pdfY1[np.where(pdfY1 < 0)[0]] = 0.0
        pdfY2 = pdfY2 * emResults[fileName]['params']['pi']
        pdfY2[np.where(pdfY2 < 0)[0]] = 0.0

        ax.plot(pdfX1, pdfY1, 'k-', linewidth=2)
        ax.plot(pdfX2, pdfY2, 'k-', linewidth=2)
        threshY = np.linspace(0,max([max(pdfY1),max(pdfY2)]),100)
        threshX = np.array([emResults[fileName]['cutpoint']]).repeat(100)
        ax.plot(threshX, threshY, 'r-', linewidth=2)
        ax.set_title(fileName,fontsize=9)
        xticklabels = plt.getp(plt.gca(),'xticklabels')
        yticklabels = plt.getp(plt.gca(),'yticklabels')
        plt.setp(xticklabels, fontsize=fontSize-1)
        plt.setp(yticklabels, fontsize=fontSize-1)

        ax.set_xlabel(round(emResults[fileName]['params']['likelihood']))

        ax.set_xticks([])

    fig.subplots_adjust(hspace=0.3,wspace=0.3)
    plt.savefig(figName)
开发者ID:ajrichards,项目名称:cytostream,代码行数:55,代码来源:Thresholds.py

示例11: display2Dpointset

def display2Dpointset(A):
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
    labels = plt.getp(plt.gca(), 'xticklabels')
    plt.setp(labels, color='k', fontweight='bold')
    labels = plt.getp(plt.gca(), 'yticklabels')
    plt.setp(labels, color='k', fontweight='bold')
    for i,x in enumerate(A):
        ax.annotate('%d'%(i+1), xy = x, xytext = x + 0)
    return None
开发者ID:YidiCao,项目名称:RPSR,代码行数:11,代码来源:_plotting.py

示例12: plotSolution

def plotSolution(time):
   x = domainVars.x
   phi = flowVars.phi
   exac = flowVars.exac
   imax = len(phi)
   pltFile = 'solution_%5.3f.png' % float(time)
   MinX = min(x)
   MaxX = max(x)
   MinY = -0.1#min(phi)
   MaxY = 1.0#1.1*max(phi)

   p = plt.plot(x,phi, 'k-', label='Numerical solution')
   p = plt.plot(x,exac, 'r--', label='Exact solution')
   plt.setp(p, linewidth='3.0')

   plt.axis([MinX,MaxX, MinY, MaxY])
   plt.xscale('linear')
   plt.yscale('linear')
   plt.xlabel('x', fontsize=22)
   plt.ylabel('phi', fontsize=22)

   plt.grid(True)
   #plt.text(0.01, 0.2, 'Grid size = %s' % len(phi), fontsize=22 )
   ax = plt.gca()
   xlabels = plt.getp(ax, 'xticklabels')
   ylabels = plt.getp(ax, 'yticklabels')
   plt.setp(xlabels, fontsize=18)
   plt.setp(ylabels, fontsize=18)
   plt.legend(
             loc='upper right',
             borderpad=0.25,
             handletextpad=0.25,
             borderaxespad=0.25,
             labelspacing=0.0,
             handlelength=2.0,
             numpoints=1)
   legendText = plt.gca().get_legend().get_texts()
   plt.setp(legendText, fontsize=18)
   legend = plt.gca().get_legend()
   legend.draw_frame(False)

   fig = plt.gcf()
   fig.set_size_inches(8,5)
   plt.tight_layout()
   plt.savefig(pltFile, format='png')
   plt.close()

   print "%s DONE!!" % (pltFile)

   # write a CSVfile
   csvFile = 'solution_%5.3f.csv' % float(time)
   writeCSV(csvFile,x,phi,exac)
开发者ID:sayop,项目名称:CFM02,代码行数:52,代码来源:post.py

示例13: _update_segment

 def _update_segment(self):
     segments = self.marker.get_segments()
     segments[0][0, 0] = self.get_data_position('x1')
     segments[0][1, 0] = segments[0][0, 0]
     if self.get_data_position('y1') is None:
         segments[0][0, 1] = plt.getp(self.marker.axes, 'ylim')[0]
     else:
         segments[0][0, 1] = self.get_data_position('y1')
     if self.get_data_position('y2') is None:
         segments[0][1, 1] = plt.getp(self.marker.axes, 'ylim')[1]
     else:
         segments[0][1, 1] = self.get_data_position('y2')
     self.marker.set_segments(segments)
开发者ID:jerevon,项目名称:hyperspy,代码行数:13,代码来源:vertical_line_segment.py

示例14: display2Dpointsets

def display2Dpointsets(A, B, ax = None):
    """ display a pair of 2D point sets """
    if not ax:
        fig = plt.figure()
        ax = fig.add_subplot(111)

    ax.plot(A[:,0],A[:,1],'yo',markersize=8,mew=1)
    ax.plot(B[:,0],B[:,1],'b+',markersize=8,mew=1)
    #pylab.setp(pylab.gca(), 'xlim', [-0.15,0.6])
    labels = plt.getp(plt.gca(), 'xticklabels')
    plt.setp(labels, color='k', fontweight='bold')
    labels = plt.getp(plt.gca(), 'yticklabels')
    plt.setp(labels, color='k', fontweight='bold')
开发者ID:alxio,项目名称:gmmreg,代码行数:13,代码来源:_plotting.py

示例15: set_ticks_fontsize

def set_ticks_fontsize(fontsize, colbar=None):
    """ Change the fontsize of the tick labels for the current figure.
    If colorbar (Colorbar instance) is provided then change the fontsize of its
    tick labels as well.
    """

    yticklabels = plt.getp(plt.gca(), 'yticklabels')
    plt.setp(yticklabels, 'color', 'k', fontsize=fontsize)
    xticklabels = plt.getp(plt.gca(), 'xticklabels')
    plt.setp(xticklabels, 'color', 'k', fontsize=fontsize)

    if colbar is not None:
        ticklabels = plt.getp(colbar.ax, 'yticklabels')
        plt.setp(ticklabels, 'color', 'k', fontsize=fontsize)
开发者ID:Solvi,项目名称:pyhrf,代码行数:14,代码来源:plot.py


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