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


Python matplotlib.plot函数代码示例

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


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

示例1: genCurve

def genCurve(dataSet, tree):
	x = [] # stores the x axis of the graph
	trainList = [] # the list of accuracies derived from training data
	valList = [] # the list of accuracies derived from validation data
	i = 0
	while i < 1: 
		i = i+0.1
		a = 0
		b = 0
		for trial in range(3):
			newData = sortData(dataSet, i) # MAKE THIS
			tree = getTree(newData) # NEED TO GET THIS FUNCTION WHEN TREEGEN WORKS
			a = a + model_validation.validateTree(tree, newData)
			b = b + model_validation.validateTree(tree, newData)
		a = float(a)/3
		b = float(b)/3

		trainList.append(a)
		valList.append(b)
		x.append(i)

	plt.plot(x, trainList)
	plt.plot(x, valList)
	plt.xlabel('percent training used')
	plt.ylabel('percent accuracy')
	plt.title('learning curve')
	plt.show()
开发者ID:guiklink,项目名称:eecs349_machine_learning_hw2,代码行数:27,代码来源:make_graph.py

示例2: shist

 def shist(self,data,sflag,spath,sname,pflag):
     g.tprinter('Running sist',pflag)
     xdata=data[:,0]
     ydata=data[:,1]
     plt.plot(xdata,ydata,'ro')
     plt.savefig(os.path.join(spath,str(sname))+'.pdf')
     plt.close()
开发者ID:OliStein,项目名称:minions,代码行数:7,代码来源:plotter.py

示例3: plotRaster

def plotRaster(clustaArray=[]):

    if len(clustaArray) < 1:
        print "Nothing to plot!"
    else:
        # create list of times that maps to each spike
        p_sptimes = []
        for a in clustaArray:
            for b in a.spike_samples:
                p_sptimes.append(b)
        sptimes = np.array(p_sptimes)

        p_clusters = []
        for c in clustaArray:
            for d in c.id_of_spike:
                p_clusters.append(c.id_of_clusta)
        clusters = np.array(p_clusters)

        # dynamically generate cluster list
        clusterList = []
        for a in clustaArray:
            clusterList.append(a.id_of_clusta)
        # plot raster for all clusters

        # nclusters = 20

        # #for n in range(nclusters):
        timesList = []
        for n in clusterList:
            # if n<>9:
            ctimes = sptimes[clusters == n]
            timesList.append(ctimes)
            plt.plot(ctimes, np.ones(len(ctimes)) * n, "|")
        plt.show()
开发者ID:RaymondDunn,项目名称:branco_pipeline,代码行数:34,代码来源:generateGraphs.py

示例4: show_data_set_plot

    def show_data_set_plot(self):

        data_plots = []
        for i in range(self.data_set.shape[1]):
            data_plots.append(go.Scatter(x=list(range(self.data_set.shape[0])), y=self.data_set[:, i], mode="markers", name="Characteristic "+str(i+1)))

        plot(data_plots, filename="Dataset.html")

        # Add delay between plots showing to avoid crashing of browser
        time.sleep(1.5)
开发者ID:b14ckfir3,项目名称:Rbfc,代码行数:10,代码来源:Rbfc.py

示例5: plotsig

def plotsig (ReconSig, electrode):
    """
    plots the reconstructed signal and the original
    
    in: ReconSig, the reconstructed signal
        electrode, the original signal
    """
    plt.plot (ReconSig)
    plt.plot (electrode)
    plt.show
开发者ID:jdestupinan1332,项目名称:TareasComp,代码行数:10,代码来源:sk.py

示例6: plotDataFrame

 def plotDataFrame(self, variables):
     try:
         import matplotlib.pyplot as plt
     except ImportError:
         print "Unable to import matplotlib"
     plt.plot(self.df[variables[0]], self.df[variables[1]])
     plt.xlabel(r"{}".format(variables[0]))
     plt.ylabel(r"$P$")
     plt.minorticks_on()
     plt.show()
开发者ID:dsmiff,项目名称:pandasUtils,代码行数:10,代码来源:pandasCore.py

示例7: plot2D

def plot2D(x,y,x_ex,y_ex,ylabl):

    #static variable counter
    plot2D.fig_num += 1

    plt.subplot(2,2,plot2D.fig_num)
    plt.xlabel('$x$ (cm)')
    plt.ylabel(ylabl)
    plt.plot(x,y,"b+-",label="Lagrangian")
    plt.plot(x_ex,y_ex,"r--",label="Exact")
    plt.savefig("var_"+str(plot2D.fig_num)+".pdf")
开发者ID:jhansel,项目名称:radhydro,代码行数:11,代码来源:lag_hydro.py

示例8: draw_circle

def draw_circle(c,r):
	t = arange(0,1.01,.01)*2*pi
	x = r*cos(t) + c[0]
	y = r*sin(t) + c[1]
	plt.plot(x,y,'b',linewidth=2)
	plt.imshow(im)
	if circle:
		for p in locs:
			plt.draw_circle(p[:2],p[2])
	else:
		plt.plot(locs[:,0],locs[:,1],'ob')
	plt.axis('off')
开发者ID:maxschommer,项目名称:Multirotors,代码行数:12,代码来源:sift.py

示例9: plot2D

def plot2D(x,y,ylabl,x_ex=None,y_ex=None):

    #static variable counter
    plot2D.fig_num += 1

    plt.subplot(2,2,plot2D.fig_num)
    plt.xlabel('$x$ (cm)')
    plt.ylabel(ylabl)
    plt.plot(x,y,"b+-",label="Numerical")
    if (x_ex != None):
        plt.plot(x_ex,y_ex,"r-x",label="Exact")

    plt.savefig("var_"+str(plot2D.fig_num)+".pdf")
开发者ID:jhansel,项目名称:radhydro,代码行数:13,代码来源:muscl_hanc.py

示例10: viz_losses

def viz_losses(filename, losses):
  if '.' not in filename: filename += '.png'

  x = history['epoch']
  legend = losses.keys

  for v in losses.values: plt.plot(np.arange(len(v)) + 1, v, marker='.')

  plt.title('Loss over epochs')
  plt.xlabel('Epochs')
  plt.xticks(history['epoch'], history['epoch'])
  plt.legend(legend, loc = 'upper right')
  plt.savefig(filename)
开发者ID:AhmedKamalAK,项目名称:py_ml_utils,代码行数:13,代码来源:visualize.py

示例11: get_trajectories_for_DF

def get_trajectories_for_DF(DF):
    GetXYS=ct.get_xys(DF)
    xys_s=ct.get_xys_s(GetXYS['xys'],GetXYS['Nmin'])
    plt.figure(figsize=(5, 5),frameon=False)
    for m in list(range(9)):
        plt.plot()
        plt.subplot(3,3,m+1)
        xys_s_x_n=xys_s[m]['X']-min(xys_s[m]['X'])
        xys_s_y_n=xys_s[m]['Y']-min(xys_s[m]['Y'])
        plt.plot(xys_s_x_n,xys_s_y_n)
        plt.axis('off')
        axes = plt.gca()
        axes.set_ylim([0,125])
        axes.set_xlim([0,125])
开发者ID:bmdaort,项目名称:3D_CellTracking_Analysis,代码行数:14,代码来源:use_tracking_functions.py

示例12: plotHistogram

def plotHistogram(clustaArray=[]):
    if len(clustaArray) < 1:
        print "Nothing to plot!"
    else:
        # create list of times that maps to each spike
        p_sptimes = []
        for a in clustaArray:
            for b in a.spike_samples:
                p_sptimes.append(b)
        sptimes = np.array(p_sptimes)

        p_clusters = []
        for c in clustaArray:
            for d in c.id_of_spike:
                p_clusters.append(c.id_of_clusta)
        clusters = np.array(p_clusters)

        # dynamically generate cluster list
        clusterList = []
        for a in clustaArray:
            clusterList.append(a.id_of_clusta)

        # plot raster for all clusters
        # nclusters = 20

        # #for n in range(nclusters):
        timesList = []
        for n in clusterList:
            # if n<>9:
            ctimes = sptimes[clusters == n]
            timesList.append(ctimes)
            # plt.plot(ctimes, np.ones(len(ctimes))*n, '|')
        # plt.show()

        # plot frequency in Hz over time
        dt = 1 / 30000.0  # in seconds
        binSize = 1  # in seconds
        binSizeSamples = round(binSize / dt)
        recLen = np.max(sptimes)
        nbins = round(recLen / binSizeSamples)

        binCount = []
        cluster = 3
        for b in np.arange(0, nbins - 1):
            n = np.sum((timesList[cluster] > b * binSizeSamples) & (timesList[cluster] < (b + 1) * binSizeSamples))
            binCount.append(n / binSize)  # makes Hz

        plt.plot(binCount)
        plt.ylim([0, 20])
        plt.show()
开发者ID:RaymondDunn,项目名称:branco_pipeline,代码行数:50,代码来源:generateGraphs.py

示例13: animate_plotting

def animate_plotting(subdir_path,):
    average_filename = 'averaged_out.txt'  
    if os.path.exists( os.path.join(subdir_path,average_filename) ):
            print(subdir_path+average_filename+' already exists please use hotPlot.py')        
            #import existing data for average at the end           
#            data_out = numpy.genfromtxt(os.path.join(subdir_path,average_filename))
#            averaged_data = numpy.array(data_out[:,1])
#            angles = data_out[:,0]
            #os.remove( os.path.join(subdir_path,average_filename))
    else:
        files = os.listdir(subdir_path)     
            #files = [d for d in os.listdir(subdir_path) if os.path.isdir(os.path.join(subdir_path, d))]
        onlyfiles_path = [os.path.join(subdir_path,f) for f in files if os.path.isfile(os.path.join(subdir_path,f))]
        onlyfiles_path = natsort.natsorted(onlyfiles_path)          
        averaged_data = []
        angles = []
        for f in onlyfiles_path:
            data = numpy.genfromtxt(f,delimiter = ',')       
            #data = pandas.read_csv(f)
            averaged_data.append(numpy.mean(data))
            angle = os.path.basename(f).split('_')[0]
            angles.append(float(angle))
        fig = plt.plot(angles, averaged_data,'o')
        plt.yscale('log')
        plt.xscale('log')
        plt.legend(loc='upper right')
        plt.title(base_path)
        plt.grid(True)
        plt.xlabel(r'$\theta$ $[deg.]}$')
        #plt.xlabel(r'$\mathrm{xlabel\;with\;\LaTeX\;font}$')
        plt.ylabel(r'I($\theta$) $[a.u.]$')
开发者ID:phcerdan,项目名称:scatteringLab-IFS,代码行数:31,代码来源:hotPlotLive.py

示例14: plot_data

def plot_data():
	import matplotlib.pylab as plt
	t, suffering = np.loadtxt('suffering.dat', unpack= True, usecols = (0,1))
	t, fitness = np.loadtxt('fitness.dat', unpack = True, usecols = (0,1))


	plt.plot(t, suffering)
	plt.xlabel('t')
	plt.ylabel('suffering')
	plt.savefig('suffering.png')
	plt.close()

	plt.plot(t, fitness)
	plt.xlabel('t')
	plt.ylabel('fitness')
	plt.savefig('fitness.png')
	plt.close()
开发者ID:colemathis,项目名称:BlackQueen,代码行数:17,代码来源:Output.py

示例15: plotEqDistn

def plotEqDistn(r1, r2, board):
    xs = []
    ys =[]
    
    handCount = 0.0
    
    for hand in r1.getHandsSortedAndEquities(r2, board):
        #plot hand at (handCount, equity) and (handCount + r1.getFrac(hand[0]), equity)
        xs.append(handCount)
        handCount += r1.getFrac(hand[0])
        xs.append(handCount)
        ys.append(hand[1])
        ys.append(hand[1])
        
    
    
    plot (xs, ys)
开发者ID:github-account-because-they-want-it,项目名称:PokerViewer,代码行数:17,代码来源:notebook.py


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