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


Python pyqtgraph.plot函数代码示例

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


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

示例1: plot_trace

def plot_trace(xy, ids = None, depth = 0, colormap = 'rainbow', line_color = 'k', line_width = 1, point_size = 5, title = None):
  """Plot trajectories with positions color coded according to discrete ids"""
  
  #if ids is not None:
  uids = np.unique(ids);
  
  cmap = cm.get_cmap(colormap);
  n = len(uids);
  colors = cmap(range(n), bytes = True);
  
  #lines
  if line_width is not None:
    #plt.plot(xy[:,0], xy[:,1], color = lines);    
    plot = pg.plot(xy[:,0], xy[:,1], pen = pg.mkPen(color = line_color, width = line_width))    
  else:
    plot = pg.plot(title = title);
    
  if ids is None:
    sp = pg.ScatterPlotItem(pos = xy, size=point_size, pen=pg.mkPen(colors[0])); #, pxMode=True);
  else:
    sp = pg.ScatterPlotItem(size=point_size); #, pxMode=True);
    spots = [];
    for j,i in enumerate(uids):
      idx = ids == i;
      spots.append({'pos': xy[idx,:].T, 'data': 1, 'brush':pg.mkBrush(colors[j])}); #, 'size': point_size});
    sp.addPoints(spots)
  
  plot.addItem(sp);
  
  return plot;
开发者ID:ChristophKirst,项目名称:CElegansBehaviour,代码行数:30,代码来源:plot.py

示例2: plotAll

def plotAll(f):
    """plot all arrays in file f (code reference)"""
    for g in f.walkGroups():
        print(g)
        for arr in f.listNodes(g, classname='Array'):
            if arr.ndim == 1 and arr.shape[0] > 1:
                pg.plot(arr.read())
开发者ID:jerasky,项目名称:plotting-programs,代码行数:7,代码来源:kplot.py

示例3: simplePlot

def simplePlot():
    data = np.random.normal(size=1000)
    pg.plot(data, title="Simplest possible plotting example")

    data = np.random.normal(size=(500,500))
    pg.image(data, title="Simplest possible image example")
    pg.QtGui.QApplication.exec_()
开发者ID:profjrr,项目名称:OETC2014_PythonInClassroom_ProfJRR,代码行数:7,代码来源:Mod2Run2.py

示例4: plotPower

 def plotPower(fftData, N, C, F):
   v = np.absolute(np.fft.fftshift(fftData) / N)
   sqV = v * v
   p = sqV / 50.0 * 1000 * 2 # * 2 is made to take care of the fact that FFT is two-sided
   pdBm = np.log10(p) * 10
   print "max = %f" % np.max(pdBm)
   print "avg = %f" % np.average(pdBm)
   #pg.plot(np.linspace(-Fs/2, Fs/2 - Fs / N, N), pdBm)
   s1 = N/2 + N * F / Fs - N * 1000000 / Fs
   s2 = N/2 + N * F / Fs + N * 1000000 / Fs
   pg.plot(pdBm[int(s1):int(s2)])
开发者ID:rinatzakirov,项目名称:vhdl,代码行数:11,代码来源:ddr_analyze.py

示例5: plotHist

    def plotHist(self, regions = None):

        '''Usage: plotHist(region = None)

        region(int): Region to be plotted. If None, plots all regions.

        Plots the current ratio histograms for the regions.

        *** Does not need event type update. *** '''

        if regions == None:

            # Plot all regions

            print "Plotting ratio histogram for all regions...\n"

            histPlot = pg.plot(title = "Ratio Histograms")
            histPlot.addLegend()

            histPlot.setLabel('left',"Counts")
            histPlot.setLabel('bottom',"Ratio")

            for i,hist in enumerate(self.rhist):

                histName = "  Region " + str(i)
                histPlot.plot(hist, pen=(i,len(self.rhist)), name=histName)

            import sys
            if(sys.flags.interactive != 1) or not hasattr(QtCore,
                                                          'PYQT_VERSION'):
                QtGui.QApplication.instance().exec_()

        else:

            # Plot the region listed

            print "Plotting ratio histogram for region", regions, "...\n"

            histPlot = pg.plot(title = "Ratio Histogram")
            histPlot.addLegend()

            histPlot.setLabel('left',"Counts")
            histPlot.setLabel('bottom',"Ratio")

            for i,region in enumerate(regions):

                histName = "  Region " + str(region)
                histPlot.plot(self.rhist[region,:],pen=(i,len(regions)),
                              name=histName)

            import sys
            if(sys.flags.interactive != 1) or not hasattr(QtCore,
                                                          'PYQT_VERSION'):
                QtGui.QApplication.instance().exec_()
开发者ID:appriest,项目名称:proximity,代码行数:54,代码来源:calibrationClass.py

示例6: _executeRun

    def _executeRun(self, testPlot=False):
        """
        (private mmethod)
        After prepare run and initialization, this routine actually calls the run method in hoc
        assembles the data, saves it to disk and plots the results.
        Inputs: flag to put up a test plot....
        """
        if verbose:
            print('_executeRun')
        assert self.run_initialized == True
        print('Starting Vm at electrode site: {:6.2f}'.format(self.electrode_site.v))
        
        # one way
        self.hf.h.t = 0
        """
        #while (self.hf.h.t < self.hf.h.tstop):
        #    for i=0, tstep/dt {
        #       self.hf.h.fadvance()
        # self.hf.h.run()  # calls finitialize, causes offset
        """
        self.hf.h.batch_save() # save nothing
        print ('Temperature in run at start: {:6.1f}'.format(self.hf.h.celsius))
        self.hf.h.batch_run(self.hf.h.tstop, self.hf.h.dt, "v.dat")
        print('Finishing Vm: {:6.2f}'.format(self.electrode_site.v))
        self.monitor['time'] = np.array(self.monitor['time'])
        self.monitor['time'][0] = 0.
        if verbose:
            print('post v: ', self.monitor['postsynapticV'])
        if testPlot:
           pg.plot(np.array(self.monitor['time']), np.array(self.monitor['postsynapticV']))
           QtGui.QApplication.instance().exec_()
           # pg.mkQApp()
            # pl = pg.plot(np.array(self.monitor['time']), np.array(self.monitor['postsynapticV']))
            # if self.filename is not None:
            #     pl.setTitle('%s' % self.filename)
            # else:
            #     pl.setTitle('executeRun, no filename')
        print ('    Run finished')
        np_monitor = {}
        for k in self.monitor.keys():
            np_monitor[k] = np.array(self.monitor[k])

        np_allsecVec = OrderedDict()
        for k in self.allsecVec.keys():
            np_allsecVec[k] = np.array(self.allsecVec[k])
        self.runInfo.clist = self.clist
        results = Params(Sections=list(self.hf.sections.keys()),  vec=np_allsecVec,
                         monitor=np_monitor, stim=self.stim, runInfo=self.runInfo,
                         distanceMap = self.hf.distanceMap,
        )
        if verbose:
            print('    _executeRun completed')
        return results
开发者ID:pbmanis,项目名称:VCNModel,代码行数:53,代码来源:generate_run.py

示例7: simplePlot

def simplePlot():
    data = np.random.normal(size=1000)
    pg.plot(data, title="Simplest possible plotting example")

    data = np.random.normal(size=(500,500))
    pg.image(data, title="Simplest possible image example")

    ## Start Qt event loop unless running in interactive mode or using pyside.
    if __name__ == '__main__':
        import sys
        if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
            pg.QtGui.QApplication.exec_()
开发者ID:profjrr,项目名称:OETC2014_PythonInClassroom_ProfJRR,代码行数:12,代码来源:Mod2Run1.py

示例8: __init__

    def __init__(self):
        # start a pyqtgraph application (sigh...)
        self.buffer_depth = 1000
        
        # Always start by initializing Qt (only once per application)
        app = QtGui.QApplication([])

        # powerstack
        self.powerstack_init = True
        self.xray_power   = collections.deque(maxlen = self.buffer_depth)
        
        self.plt_powerstack = pg.PlotItem(title = 'xray power vs event')
        self.w_powerstack = pg.ImageView(view = self.plt_powerstack)
            
        bottom = self.plt_powerstack.getAxis('bottom')
        bottom.setLabel('delay (fs)')

        left = self.plt_powerstack.getAxis('left')
        left.setLabel('event number ')

        # power vs delay
        self.w_xray_power = pg.plot(title = 'xray power vs delay')
        self.w_xray_power.setLabel('bottom', 'delay (fs)')
        self.w_xray_power.setLabel('left', 'power (GW)')

        # delay
        self.delay        = collections.deque(maxlen = self.buffer_depth)
        self.event_number = collections.deque(maxlen = self.buffer_depth)
        self.w_delay = pg.plot(title = 'time between the two xray pulses')
        self.w_delay.setLabel('bottom', 'event')
        self.w_delay.setLabel('left', 'delay (fs)')

        # xtcav images
        self.plt_xtcav  = pg.PlotItem(title = 'processed xtcav image')
        self.xtcav_init = True
        self.w_xtcav = pg.ImageView(view = self.plt_xtcav)

        bottom = self.plt_xtcav.getAxis('bottom')
        bottom.setLabel('delay (fs)')

        left = self.plt_xtcav.getAxis('left')
        left.setLabel('electron energy (MeV)')

        ## Start the Qt event loop
        signal.signal(signal.SIGINT, signal.SIG_DFL)    # allow Control-C
        
        self.catch_data()

        sys.exit(app.exec_())
开发者ID:andyofmelbourne,项目名称:SLAC-scripts,代码行数:49,代码来源:xtcav_gui.py

示例9: plotbar

def plotbar(arrY, x=None, color=None, hold=None, figureNo=None, width=0.6):
    global CURR, PLOTS
    arrY = N.asarray( arrY )
    
    if x is not None:
        x = N.asarray(x)
    else:
        x = N.arange(arrY.shape[-1])
        
    if len(arrY.shape) > 1 and arrY.shape[0] >  arrY.shape[1]:
        arrY = N.transpose(arrY)

    pw = plothold(hold, figureNo)
    append = pw == pg
    if append:
        pw = pg.plot()

    kwd = {}
    kwd['pen'] = _pen(pw, color)
    kwd['brush'] = _brush(pw, color)
    kwd['width'] = width
    

    if len(arrY.shape) == 1:
        bg = pg.BarGraphItem(x=x, height=arrY, **kwd)
        pw.addItem(bg)
    else:
        data = []
        for i in range(arr.shape[0]):
            bg = pg.BarGraphItem(x=x, height=arrY[i], **kwd)
            pw.addItem(bg)
            
    if append:
        PLOTS.append(pw)
开发者ID:macronucleus,项目名称:Chromagnon,代码行数:34,代码来源:usefulP3.py

示例10: plot

    def plot(self, Rs=None, Vg=0):
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')

        # Generate plot
        plt = pg.plot(title=self.__class__.__name__, clear=True)
        plt.setYRange(0, self.IDSS_MAX)
        plt.setXRange(self.VP_MAX, 0)
        plt.showGrid(True, True, 1.0)
        plt.setLabel('left', "Id (mA)")
        plt.setLabel('bottom', "Vgs (V)")

        (x, y) = self.id_max_points()
        plt.plot(x, y, pen=pg.mkPen('g', width=3))

        (x, y) = self.id_min_points()
        plt.plot(x, y, pen=pg.mkPen('b', width=3))

        if Rs is not None:
            (x, y) = self.vg_intercept(Rs, Vg)
            plt.plot(x, y, pen=pg.mkPen('r', width=3))

        # Display plot
        QtGui.QApplication.instance().exec_()
        pg.exit()
开发者ID:devttys0,项目名称:EE,代码行数:25,代码来源:jfet.py

示例11: show_fft

	def show_fft(self):
		for ch in range(4):
			if self.chanStatus[ch] == 1:
				try:	
					fa = em.fit_sine(self.timeData[ch],self.voltData[ch])
				except Exception as err:
					print('fit_sine error:', err)
					fa=None
				if fa != None:
					fr = fa[1][1]*1000			# frequency in Hz
					dt = int(1.e6/ (20 * fr))	# dt in usecs, 20 samples per cycle
					try:
						t,v = self.p.capture1(self.sources[ch], 3000, dt)
					except:
						self.comerr()

					xa,ya = em.fft(v,dt)
					xa *= 1000
					peak = self.peak_index(xa,ya)
					ypos = np.max(ya)
					pop = pg.plot(xa,ya, pen = self.traceCols[ch])
					pop.showGrid(x=True, y=True)
					txt = pg.TextItem(text=unicode(self.tr('Fundamental frequency = %5.1f Hz')) %peak, color = 'w')
					txt.setPos(peak, ypos)
					pop.addItem(txt)
					pop.setWindowTitle(self.tr('Frequency Spectrum'))
				else:
					self.msg(self.tr('FFT Error'))
开发者ID:expeyes,项目名称:expeyes-programs,代码行数:28,代码来源:scope.py

示例12: estimate_kinetics

    def estimate_kinetics(self, plot=False):
        kinetics_group = self.kinetics_group
        
        # Generate average decay phase
        avg_kinetic = kinetics_group.bsub_mean()
        avg_kinetic.t0 = 0
        
        if plot:
            kin_plot = pg.plot(title='Kinetics')
            kin_plot.plot(avg_kinetic.time_values, avg_kinetic.data)
        else:
            kin_plot = None
        
        # Make initial kinetics estimate
        amp_est = self._psp_estimate['amp']
        amp_sign = '-' if amp_est < 0 else '+'
        kin_fit = fit_psp(avg_kinetic, sign=amp_sign, yoffset=0, amp=amp_est, method='leastsq', fit_kws={})
        if plot:
            kin_plot.plot(avg_kinetic.time_values, kin_fit.eval(), pen='b')
        rise_time = kin_fit.best_values['rise_time']
        decay_tau = kin_fit.best_values['decay_tau']
        latency = kin_fit.best_values['xoffset'] - 10e-3

        self._psp_estimate['rise_time'] = rise_time
        self._psp_estimate['decay_tau'] = decay_tau
        self._psp_estimate['latency'] = latency
        
        return rise_time, decay_tau, latency, kin_plot
开发者ID:corinneteeter,项目名称:multipatch_analysis,代码行数:28,代码来源:synaptic_dynamics.py

示例13: estimate_amplitude

    def estimate_amplitude(self, plot=False):
        amp_group = self.amp_group
        amp_est = None
        amp_plot = None
        amp_sign = None
        avg_amp = None
        n_sweeps = len(amp_group)
        if n_sweeps == 0:
            return amp_est, amp_sign, avg_amp, amp_plot, n_sweeps
        # Generate average first response
        avg_amp = amp_group.bsub_mean()
        if plot:
            amp_plot = pg.plot(title='First pulse amplitude')
            amp_plot.plot(avg_amp.time_values, avg_amp.data)

        # Make initial amplitude estimate
        ad = avg_amp.data
        dt = avg_amp.dt
        base = float_mode(ad[:int(10e-3/dt)])
        neg = ad[int(13e-3/dt):].min() - base
        pos = ad[int(13e-3/dt):].max() - base
        amp_est = neg if abs(neg) > abs(pos) else pos
        if plot:
            amp_plot.addLine(y=base + amp_est)
        amp_sign = '-' if amp_est < 0 else '+'
        
        self._psp_estimate['amp'] = amp_est
        self._psp_estimate['amp_sign'] = amp_sign
        
        return amp_est, amp_sign, avg_amp, amp_plot, n_sweeps
开发者ID:corinneteeter,项目名称:multipatch_analysis,代码行数:30,代码来源:synaptic_dynamics.py

示例14: ShowGraph

 def ShowGraph(self):
     """        
     app = QtGui.QApplication(sys.argv)
     widget = pg.PlotWidget(title="Stock Performance")
     widget.setWindowTitle("Graph")
     widget.plotItem.plot(floatStockClosePrice)
     """        
     ticker = str(self.lineEdit.text())
     if self.radioButton_3.isChecked() or self.radioButton_4.isChecked() and ticker in theTickers:
         
         widget = pg.plot(floatStockClosePrice, title="Graph")       
             
         ax = widget.getPlotItem().getAxis("left")
         ax.setLabel("Price")
         ax.setGrid(200)
         ax.showLabel()
         
         ax = widget.getPlotItem().getAxis("bottom")
         ax.setLabel("Year")
         ax.setGrid(200)
         ax.showLabel()
             
         widget.show()           
     
     else:
         Tkinter.Tk().withdraw()
         tkMessageBox.showerror("Error: Stock Not Found", "Please try again and click 'See Projection' for graph to show.")
开发者ID:Logic864,项目名称:School_Work,代码行数:27,代码来源:officialgui.py

示例15: test_lag1st_to_trig

    def test_lag1st_to_trig(self):
        # scalar case
        dest_weight = core.change_projection_base(self.src_weights, self.src_test_funcs, self.trig_test_funcs[0])
        dest_approx_handle_s = core.back_project_from_base(dest_weight, self.trig_test_funcs[0])

        # standard case
        dest_weights = core.change_projection_base(self.src_weights, self.src_test_funcs, self.trig_test_funcs)
        dest_approx_handle = core.back_project_from_base(dest_weights, self.trig_test_funcs)
        error = np.sum(np.power(
            np.subtract(self.real_func_handle(self.z_values), dest_approx_handle(self.z_values)),
            2))

        if show_plots:
            pw = pg.plot(title="change projection base")
            i1 = pw.plot(x=self.z_values, y=self.real_func_handle(self.z_values), pen="r")
            i2 = pw.plot(x=self.z_values, y=self.src_approx_handle(self.z_values),
                         pen=pg.mkPen("g", style=pg.QtCore.Qt.DashLine))
            i3 = pw.plot(x=self.z_values, y=dest_approx_handle_s(self.z_values), pen="b")
            i4 = pw.plot(x=self.z_values, y=dest_approx_handle(self.z_values), pen="c")
            legend = pw.addLegend()
            legend.addItem(i1, "f(x) = x")
            legend.addItem(i2, "2x Lagrange1st")
            legend.addItem(i3, "sin(x)")
            legend.addItem(i4, "sin(wx) with w in [1, {0}]".format(dest_weights.shape[0]))
            app.exec_()

        # should fit pretty nice
        self.assertLess(error, 1e-2)
开发者ID:rihe,项目名称:pyinduct,代码行数:28,代码来源:test_core.py


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