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

Python pyplot.grid函数代码示例

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

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



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

示例1: plotaBarra

def plotaBarra(nEntradas, nSaidas):
	n_groups = 2

	means_men = (nEntradas, nSaidas)

	fig, ax = plt.subplots()

	index = np.arange(n_groups)
	bar_width = 0.15

	opacity = 0.4

	rects1 = plt.bar(index, means_men,  bar_width, alpha=opacity, color='b')

	#plt.xlabel('Tipo de passagem')
	plt.ylabel(u'Valor absoluto', size=20)
	plt.title(u'Número de passagens', size=20)
	plt.xticks(index + bar_width/2, ('Entradas', u'Saídas'), size=16)
	plt.legend()
	plt.grid(True)
	plt.axis((0, 2, 0, nSaidas + nEntradas + 1))		

	plt.tight_layout()
	#plt.show()
	plt.ylim(0,nEntradas + nSaidas + 1)
	plt.savefig('grafico.png')
开发者ID:leo-alves-melo,项目名称:contador_online,代码行数:26,代码来源:recebe_contagem_e_manda_html_local.py


示例2: _plot

    def _plot(self,names,title,style,when=0,showLegend=True):
        if isinstance(names,str):
            names = [names]
        assert isinstance(names,list)

        legend = []
        for name in names:
            assert isinstance(name,str)
            legend.append(name)

            # if it's a differential state
            if name in self.xNames:
                index = self.xNames.index(name)
                ys = np.squeeze(self._log['x'])[:,index]
                ts = np.arange(len(ys))*self.Ts
                plt.plot(ts,ys,style)
                
            if name in self.outputNames:
                index = self.outputNames.index(name)
                ys = np.squeeze(self._log['outputs'][name])
                ts = np.arange(len(ys))*self.Ts
                plt.plot(ts,ys,style)

        if title is not None:
            assert isinstance(title,str), "title must be a string"
            plt.title(title)
        plt.xlabel('time [s]')
        if showLegend is True:
            plt.legend(legend)
        plt.grid()
开发者ID:jgillis,项目名称:rawesome,代码行数:30,代码来源:mpc_mhe_utils.py


示例3: plotTestData

def plotTestData(tree):
	plt.figure()
	plt.axis([0,1,0,1])
	plt.xlabel("X axis")
	plt.ylabel("Y axis")
	plt.title("Green: Class1, Red: Class2, Blue: Class3, Yellow: Class4")
	for value in class1:
		plt.plot(value[0],value[1],'go')
	plt.hold(True)
	for value in class2:
		plt.plot(value[0],value[1],'ro')
	plt.hold(True)
	for value in class3:
		plt.plot(value[0],value[1],'bo')
	plt.hold(True)
	for value in class4:
		plt.plot(value[0],value[1],'yo')
	plotRegion(tree)
	for value in classPlot1:
		plt.plot(value[0],value[1],'g.',ms=3.0)
	plt.hold(True)
	for value in classPlot2:
		plt.plot(value[0],value[1],'r.', ms=3.0)
	plt.hold(True)
	for value in classPlot3:
		plt.plot(value[0],value[1],'b.', ms=3.0)
	plt.hold(True)
	for value in classPlot4:
		plt.plot(value[0],value[1],'y.', ms=3.0)
	plt.grid(True)
	plt.show()
开发者ID:swatibhartiya,项目名称:Metal-Scrap-Sorter,代码行数:31,代码来源:executeDT.py


示例4: mlr_val_ridge

def mlr_val_ridge( RM, yE, rate = 2, more_train = True, center = None, alpha = 0.5, disp = True, graph = True):
	"""
	Validation is peformed as much as the given ratio.
	"""
	RMt, yEt, RMv, yEv = jchem.get_valid_mode_data( RM, yE, rate = rate, more_train = more_train, center = center)

	print("Ridge: alpha = {}".format( alpha))
	clf = linear_model.Ridge( alpha = alpha)	
	clf.fit( RMt, yEt)

	print('Weight value')
	#print clf.coef_.flatten()
	plt.plot( clf.coef_.flatten())
	plt.grid()
	plt.xlabel('Tap')
	plt.ylabel('Weight')
	plt.title('Linear Regression Weights')
	plt.show()

	print('Training result')
	mlr_show( clf, RMt, yEt, disp = disp, graph = graph)

	print('Validation result')
	r_sqr, RMSE = mlr_show( clf, RMv, yEv, disp = disp, graph = graph)

	return r_sqr, RMSE
开发者ID:jskDr,项目名称:jamespy_py3,代码行数:26,代码来源:jutil.py


示例5: mlr_val_vseq_MMSE

def mlr_val_vseq_MMSE( RM, yE, v_seq, alpha = .5, disp = True, graph = True):
	"""
	Validation is peformed using vseq indexed values.
	"""
	org_seq = list(range( len( yE)))
	t_seq = [x for x in org_seq if x not in v_seq]

	RMt, yEt = RM[ t_seq, :], yE[ t_seq, 0]
	RMv, yEv = RM[ v_seq, :], yE[ v_seq, 0]

	w, RMt_1 = mmse_with_bias( RMt, yEt)
	yEt_c = RMt_1*w

	print('Weight values')
	#print clf.coef_.flatten()
	plt.plot( w.A1)
	plt.grid()
	plt.xlabel('Tap')
	plt.ylabel('Weight')
	plt.title('Linear Regression Weights')
	plt.show()

	RMv_1 = add_bias_xM( RMv)
	yEv_c = RMv_1*w

	if disp: print('Training result')
	regress_show( yEt, yEt_c, disp = disp, graph = graph)

	if disp: print('Validation result')
	r_sqr, RMSE = regress_show( yEv, yEv_c, disp = disp, graph = graph)

	#if r_sqr < 0:
	#	print 'v_seq:', v_seq, '--> r_sqr = ', r_sqr

	return r_sqr, RMSE	
开发者ID:jskDr,项目名称:jamespy_py3,代码行数:35,代码来源:jutil.py


示例6: plotFFT

	def plotFFT(self):
	# Generates plot of the FFT output. To view, run plotFFT.py in a separate terminal
		figure1 = plt.figure(num= None, figsize=(12,12), dpi=80, facecolor='w', edgecolor='w')
		plot1 = figure1.add_subplot(111)
		line1, = plot1.plot( np.arange(0,512,0.5), np.zeros(1024), 'g-')
		plt.xlabel('freq (MHz)',fontsize = 12)
		plt.ylabel('Amplitude',fontsize = 12)
		plt.title('Pre-mixer FFT',fontsize = 12)
		plt.xticks(np.arange(0,512,50))
		plt.xlim((0,512))
		plt.grid()
		plt.show(block = False)
		count = 0 
		stop = 1.0e6
		while(count < stop):
			overflow = np.fromstring(self.fpga.read('overflow', 4), dtype = '>B')
			print overflow
			self.fpga.write_int('fft_snap_ctrl',0)
			self.fpga.write_int('fft_snap_ctrl',1)
			fft_snap = (np.fromstring(self.fpga.read('fft_snap_bram',(2**9)*8),dtype='>i2')).astype('float')
			I0 = fft_snap[0::4]
			Q0 = fft_snap[1::4]
			I1 = fft_snap[2::4]
			Q1 = fft_snap[3::4]
			mag0 = np.sqrt(I0**2 + Q0**2)
			mag1 = np.sqrt(I1**2 + Q1**2)
			fft_mags = np.hstack(zip(mag0,mag1))
			plt.ylim((0,np.max(fft_mags) + 300.))
			line1.set_ydata((fft_mags))
			plt.draw()
			count += 1
开发者ID:braddober,项目名称:blastfirmware,代码行数:31,代码来源:blastfirmware_dirfile.py


示例7: make_let_im

def make_let_im(let_file, dim = 16, y_lo = 70, y_hi = 220, x_lo = 10, x_hi = 200, edge_pix = 150, plot_let = False):

    letter = mpimg.imread(let_file)

    letter = letter[y_lo:y_hi, x_lo:x_hi, 0]
    for i in range(letter.shape[1]):
        if letter[0:edge_pix, i].any() == 0:   # here is to remove the edge
            letter[0:edge_pix, i] = 1
    
    plt.imshow(letter, cmap='gray')
    plt.grid('off')
    plt.show()
        
    x = np.arange(letter.shape[1])
    y = np.arange(letter.shape[0])

    f2d = interp2d(x, y, letter)

    x_new = np.linspace(0, letter.shape[1], dim)    # dim = 16
    y_new = np.linspace(0, letter.shape[0], dim)

    letter_new = f2d(x_new, y_new)
    letter_new -= np.mean(letter_new)
    
    if plot_let: 
        plt.imshow(letter_new, cmap = 'gray')
        plt.grid('off')
        plt.show()
        
    letter_flat = letter_new.flatten()   # letter_flat is a 1-dimensional array containing 256 elements
    
    return letter_new, letter_flat
开发者ID:COMPPHYS-WGAO,项目名称:comp-phys,代码行数:32,代码来源:pca_letters.py


示例8: makePlot

def makePlot(
                k,
                counts,
                yaxis=[],
                width=0.8,
                figsize=[14.0,8.0],
                title="",
                ylabel='tmpylabel',
                xlabel='tmpxlabel',
                labels=[],
                show=False,
                grid=True,
                xticks=[],
                yticks=[],
                steps=5,
                save=False
            ):
    '''
    '''
    if not list(yaxis):
        yaxis = np.arange(len(counts))
    if not labels:
        labels = yaxis
    index = np.arange(len(yaxis))

    fig, ax = plt.subplots()
    fig.set_size_inches(figsize[0],figsize[1])
    plt.bar(index, counts, width)

    plt.title(title)
    if not xticks:
        print ('Making xticks')
        ticks = makeTicks(yMax=len(yaxis),steps=steps)
        xticks.append(ticks+width/2.)
        xticks.append(labels)
        print ('Done making xticks')

    if yticks:
        print ('Making yticks')
        # plt.yticks([1,2000],[0,100])
        plt.yticks(yticks[0],yticks[1])
        # ax.set_yticks(np.arange(0,100,10))
        print ('Done making yticks')

    plt.xticks(xticks[0]+width/2., xticks[1])
    plt.ylabel(ylabel)
    plt.xlabel(xlabel)
    # ax.set_xticks(range(0,len(counts)+2))

    fig.autofmt_xdate()
    # ax.set_xticklabels(ks)

    plt.axis([0, len(yaxis), 0, max(counts) + (max(counts)/100)])
    plt.grid(grid)
    location = ROOT_FOLDER + "/../muchBazar/src/image/" + k + "distribution.png"
    if save:
        plt.savefig(location)
        print ('Distribution written to: %s' % location)
    if show:
        plt.show()
开发者ID:mcmhav,项目名称:suchBazar,代码行数:60,代码来源:helpers.py


示例9: draw_robot_way_2d

def draw_robot_way_2d(data_1, data_2, label_names, plate_name):
    plt.plot(data_1, data_2)
    plt.xlabel(label_names[0])
    plt.ylabel(label_names[1])
    plt.title(plate_name)
    plt.grid(True)
    plt.show()
开发者ID:egorvlgavr,项目名称:Python,代码行数:7,代码来源:drawlines.py


示例10: plot_models

def plot_models(x, y, models, fname, mx=None, ymax=None, xmin=None):
    plt.clf()
    plt.scatter(x, y, s=10)
    plt.title("Web traffic over the last month")
    plt.xlabel("Time")
    plt.ylabel("Hits/hour")
    plt.xticks([w * 7 * 24 for w in range(10)], ["week %i" % w for w in range(10)])

    if models:
        if mx is None:
            mx = sp.linspace(0, x[-1], 1000)
        for model, style, color in zip(models, linestyles, colors):
            # print "Model:",model
            # print "Coeffs:",model.coeffs
            plt.plot(mx, model(mx), linestyle=style, linewidth=2, c=color)

        plt.legend(["d=%i" % m.order for m in models], loc="upper left")

    plt.autoscale(tight=True)
    plt.ylim(ymin=0)
    if ymax:
        plt.ylim(ymax=ymax)
    if xmin:
        plt.xlim(xmin=xmin)
    plt.grid(True, linestyle="-", color="0.75")
开发者ID:statistikR,项目名称:mlSystemPy,代码行数:25,代码来源:plottingUtil.py


示例11: createResponsePlot

def createResponsePlot(dataframe,plotdir):
    mag = dataframe['MAGPDE'].as_matrix()
    response = (dataframe['TFIRSTPUB'].as_matrix())/60.0
    response[response > 60] = 60 #anything over 60 minutes capped at 6 minutes
    imag5 = (mag >= 5.0).nonzero()[0]
    imag55 = (mag >= 5.5).nonzero()[0]
    fig = plt.figure(figsize=(8,6))
    n,bins,patches = plt.hist(response[imag5],color='g',bins=60,range=(0,60))
    plt.hold(True)
    plt.hist(response[imag55],color='b',bins=60,range=(0,60))
    plt.xlabel('Response Time (min)')
    plt.ylabel('Number of earthquakes')
    plt.xticks(np.arange(0,65,5))
    ymax = text.ceilToNearest(max(n),10)
    yinc = ymax/10
    plt.yticks(np.arange(0,ymax+yinc,yinc))
    plt.grid(True,which='both')
    plt.hold(True)
    x = [20,20]
    y = [0,ymax]
    plt.plot(x,y,'r',linewidth=2,zorder=10)
    s1 = 'Magnitude 5.0, Events = %i' % (len(imag5))
    s2 = 'Magnitude 5.5, Events = %i' % (len(imag55))
    plt.text(35,.85*ymax,s1,color='g')
    plt.text(35,.75*ymax,s2,color='b')
    plt.savefig(os.path.join(plotdir,'response.pdf'))
    plt.savefig(os.path.join(plotdir,'response.png'))
    plt.close()
    print 'Saving response.pdf'
开发者ID:mhearne-usgs,项目名称:neicq,代码行数:29,代码来源:neicq.py


示例12: show_trajectory

def show_trajectory(target, xc, yc):  # pragma: no cover
    plt.clf()
    plot_arrow(target.x, target.y, target.yaw)
    plt.plot(xc, yc, "-r")
    plt.axis("equal")
    plt.grid(True)
    plt.pause(0.1)
开发者ID:AtsushiSakai,项目名称:PythonRobotics,代码行数:7,代码来源:model_predictive_trajectory_generator.py


示例13: plot_data

def plot_data(l):
	fig, ax = plt.subplots()
	counts, bins, patches = ax.hist(l,30,facecolor='yellow', edgecolor='gray')

	# Set the ticks to be at the edges of the bins.
	#ax.set_xticks(bins)
	# Set the xaxis's tick labels to be formatted with 1 decimal place...
	#ax.xaxis.set_major_formatter(FormatStrFormatter('%0.1f'))

	
	# Label the raw counts and the percentages below the x-axis...
	bin_centers = 0.5 * np.diff(bins) + bins[:-1]
	for count, x in zip(counts, bin_centers):
	    # Label the raw counts
	    ax.annotate(str(int(count)), xy=(x, 0), xycoords=('data', 'axes fraction'),
	        xytext=(0, -40), textcoords='offset points', va='top', ha='center')

	    # Label the percentages
	    percent = '%0.0f%%' % (100 * float(count) / counts.sum())
	    ax.annotate(percent, xy=(x, 0), xycoords=('data', 'axes fraction'),
	        xytext=(0, -50), textcoords='offset points', va='top', ha='center')


	# Give ourselves some more room at the bottom of the plot
	plt.subplots_adjust(bottom=0.15)
	plt.grid(True)
	plt.xlabel("total reply")
	plt.ylabel("pages")
	plt.title("2014/10/21-2014/10/22  sina new pages")
	plt.show()
开发者ID:lxserenade,项目名称:crawler,代码行数:30,代码来源:data_process.py


示例14: visualize_singular_values

def visualize_singular_values(args):
    param_values = load_parameter_values(args.load_path)
    for d in range(args.layers):
        if args.rnn_type == 'lstm':
            ws = param_values["/recurrentstack/lstm_" + str(d) + ".W_state"]
            w_rec = ws[:, 3 * args.state_dim:]
        elif args.rnn_type == 'simple':
            w_rec = param_values["/recurrentstack/simplerecurrent_" + str(d) +
                                 ".W_state"]
        else:
            raise NotImplementedError
        U, s, V = np.linalg.svd(w_rec, full_matrices=True)
        plt.subplot(2, 1, 1)
        plt.plot(np.arange(s.shape[0]), s, label='Layer_' + str(d))
        plt.grid(True)
        plt.legend(loc='upper right')
        plt.title("Singular_values_of_recurrent_weights")
        plt.subplot(2, 1, 2)
        plt.plot(np.arange(s.shape[0]), np.log(s + 1E-15),
                 label='Layer_' + str(d))
        plt.grid(True)
        plt.title("Log_singular_values_of_recurrent_weights")
    plt.tight_layout()

    plt.savefig(args.save_path + "/visualize_singular_values.png")
    logger.info("Figure \"visualize_singular_values"
                ".png\" saved at directory: " + args.save_path)
开发者ID:anirudh9119,项目名称:RNN_Experiments,代码行数:27,代码来源:visualize_singular_values.py


示例15: exec_transmissions

    def exec_transmissions():
        IP,IP_AP,files=parser_reduce()
        plt.figure("GRAPHE_D'EVOLUTION_DES_TRANSMISSIONS")
        ENS_TEMPS_, TRANSMISSION_ = transmissions(files)
        plt.plot(ENS_TEMPS_, TRANSMISSION_,"r.", label="Transmissions: ")

        lot = map(inet_aton, IP)
        lot.sort()
        iplist1 = map(inet_ntoa, lot)

        for i in iplist1: #ici j'affiche les annotations et vérifie si j'ai des @ip de longueur 9 ou 8 pour connaitre la taille de la fenetre du graphe
                if len(i)==9:
                    maxim_=i[-2:] #Sera utilisé pour la taille de la fenetre du graphe
                    plt.annotate('   Machine: '+ i ,horizontalalignment='left', xy=(1, float(i[-2:])), xytext=(1, float(i[-2:])-0.4),arrowprops=dict(facecolor='black', shrink=0.05),)
                else:
                    maxim_=i[-1:] #Sera utilisé pour la taille de la fenetre du graphe
                    plt.annotate('   Machine: '+ i ,horizontalalignment='left', xy=(1, float(i[7])), xytext=(1, float(i[7])-0.4),arrowprops=dict(facecolor='black', shrink=0.05),)
        for i in IP_AP: #ACCESS POINT ( cas spécial )
            if i[-2:]:
                plt.annotate('   access point: '+ i , xy=(1, i[7]), xytext=(1, float(i[7])-0.4),arrowprops=dict(facecolor='black', shrink=0.05),)

        plt.ylim(0, (float(maxim_))+1) #C'est à ça que sert le tri
        plt.xlim(1, 1.1)
        plt.legend(loc='best',prop={'size':10})
        plt.xlabel('Temps (s)')
        plt.ylabel('IP machines transmettrices')
        plt.grid(True)
        plt.title("GRAPHE_D'EVOLUTION_DES_TRANSMISSIONS")
        plt.legend(loc='best')
        plt.show()
开发者ID:Belkacem200,项目名称:PROGRES-PROJET2_MODULE1,代码行数:30,代码来源:projet+Progres_2_.py


示例16: PlotIOCurve

def PlotIOCurve(stRaster, rasterKey, figPath=[]):
	""" Plot the IO curves for the spikes in stRaster.        
	:param stRaster: dict of pandas.DataFrame of spike times for each cycle, for each intensity 
	:type stRaster: dict of pandas.DataFrame
	:param rasterKey: Raster key with intensity in dB following '_'
	:type rasterKey: str
	:param figPath: Directory location for plots to be saved
	:type figPath: str
	:returns: tuningCurves: pandas.DataFrame with frequency, intensity, response rate and standard deviation 
	"""
	tuning = []
	sortedKeys = sorted(stRaster.keys())
	for traceKey in sortedKeys:
		spl = int(traceKey.split('_')[-1])
		raster = stRaster[traceKey]
		res = ResponseStats( raster )
		tuning.append({'intensity': spl, 'response': res[0], 'responseSTD': res[1]})
	tuningCurves = pd.DataFrame(tuning)
	testNum = int(rasterKey.split('_')[-1])
	tuningCurves.plot(x='intensity', y='response', yerr='responseSTD', capthick=1, label='test '+str(testNum))
	plt.legend(loc='upper left', fontsize=12, frameon=True)
	sns.despine()
	plt.grid(False)
	plt.xlabel('Intensity (dB)', size=14)
	plt.ylabel('Response Rate (Hz)', size=14)
	plt.tick_params(axis='both', which='major', labelsize=14)
	title = rasterKey.split('_')[0]+'_'+rasterKey.split('_')[1]+'_'+rasterKey.split('_')[2]
	plt.title(title, size=14)
	if len(figPath)>0: 
		plt.savefig(figPath + 'ioCurves_' + title +'.png')
	return tuningCurves
开发者ID:pdroberts,项目名称:StimResponse,代码行数:31,代码来源:PharmaFunctions.py


示例17: png

 def png(self, start_timestamp, end_timestamp):
     self.load(start_timestamp, end_timestamp)
     plt.figure(figsize=(10, 7.52))
     plt.rc("axes", labelsize=12, titlesize=14)
     plt.rc("font", size=10)
     plt.rc("legend", fontsize=7)
     plt.rc("xtick", labelsize=8)
     plt.rc("ytick", labelsize=8)
     plt.axes([0.08, 0.08, 1 - 0.27, 1 - 0.15])
     for plot in self.plots:
         plt.plot(self.timestamps, self.plots[plot], self.series_fmt(plot), label=self.series_label(plot))
     plt.axis("tight")
     plt.gca().xaxis.set_major_formatter(
         matplotlib.ticker.FuncFormatter(lambda x, pos=None: time.strftime("%H:%M\n%b %d", time.localtime(x)))
     )
     plt.gca().yaxis.set_major_formatter(
         matplotlib.ticker.FuncFormatter(lambda x, pos=None: locale.format("%.*f", (0, x), True))
     )
     plt.grid(True)
     plt.legend(loc=(1.003, 0))
     plt.xlabel("Time/Date")
     plt.title(
         self.description()
         + "\n%s to %s"
         % (
             time.strftime("%H:%M %d-%b-%Y", time.localtime(start_timestamp)),
             time.strftime("%H:%M %d-%b-%Y", time.localtime(end_timestamp)),
         )
     )
     output_buffer = StringIO.StringIO()
     plt.savefig(output_buffer, format="png")
     return output_buffer.getvalue()
开发者ID:rbroemeling,项目名称:udplogger,代码行数:32,代码来源:Graphs.py


示例18: DrawFig

def DrawFig(filename):
  n1, t1 = ReadList2("ssd_read.txt")
  n2, t2 = ReadList2("hdd_read.txt")

  n3, t3 = ReadList2("ssd_write.txt")
  n4, t4 = ReadList2("hdd_write.txt")

  fig = plt.figure()
  ax = fig.add_subplot(111)
  fig.suptitle("HBase (replica 10)")
  plt.xlabel('# Entries')
  plt.ylabel('time (sec)')
#  ax.set_yscale('log')

  ax.plot(n1, t1, 'r--', label="ssd read")
  ax.plot(n1, t1, 'ro')
  ax.plot(n3, t3, 'r-', label="ssd write")
  ax.plot(n3, t3, 'r^')

  ax.plot(n2, t2, 'b--', label="hdd read")
  ax.plot(n2, t2, 'bo')
  ax.plot(n4, t4, 'b-', label="hdd write")
  ax.plot(n4, t4, 'b^')

  #plt.xlim([0.8, 8])
  plt.ylim([-20, 300])
  plt.grid(b=True, which='both', color='0.65',linestyle='-')

  ax.legend(bbox_to_anchor=(0.1, 0.9), loc=2, borderaxespad=0.)
  plt.savefig('hbase_read_write_r10.png')
  plt.show()
  return
开发者ID:lcchu,项目名称:uw-madison,代码行数:32,代码来源:hbase_read_write.py


示例19: plot2DLine

def plot2DLine(x, y, threshold, xlabel = "x", ylabel = "y", figname = "figure", title = "Track", equal = False):
    fig = plt.figure(figname)
    ax = fig.add_subplot(111)
    start = 0
    
    #set x and y axis to equal
    if equal:
        ax.axis('equal')
        
    #break lines if range of two point bigger than threshold
    for i in range(len(x) - 1):
        if sqrt((x[i] - x[i + 1])**2 + (y[i] - y[i + 1])**2) > threshold:
            ax.plot(x[start:i + 1], y[start:i + 1], 'r*')
            start = i + 1
    ax.plot(x[start:], y[start:], 'r*')
    
    
    #disable scientific notation of plot
    formatter = ScalarFormatter(useOffset=False)
    ax.yaxis.set_major_formatter(formatter)
    ax.xaxis.set_major_formatter(formatter)
    
    ax.set_title(title, size = 20)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.grid()
开发者ID:otakusaikou,项目名称:MarineSurveying,代码行数:26,代码来源:process_team1.py


示例20: run_demo

def run_demo(with_plots=True):
    """
    Distillation2 model
    """

    curr_dir = os.path.dirname(os.path.abspath(__file__));

    fmu_name = compile_fmu("JMExamples.Distillation.Distillation2", 
    curr_dir+"/files/JMExamples.mo")
    dist2 = load_fmu(fmu_name)
    
    res = dist2.simulate(final_time=7200)

    # Extract variable profiles
    x16	= res['x[16]']
    x32	= res['x[32]']
    t	= res['time']
    
    print "t = ", repr(N.array(t))
    print "x16 = ", repr(N.array(x16))
    print "x32 = ", repr(N.array(x32))

    if with_plots:
        # Plot
        plt.figure(1)
        plt.plot(t,x16,t,x32)
        plt.grid()
        plt.ylabel('x')
        
        plt.xlabel('time')
        plt.show()
开发者ID:jnorthrup,项目名称:jmodelica,代码行数:31,代码来源:distillation2_fmu.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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