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

Python visvis.plot函数代码示例

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

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



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

示例1: PlotReferencePhase

	def PlotReferencePhase (self, event) :
		"""
		Plot reference phase
		"""
		visvis.cla(); visvis.clf(); 
		
		# get actual amplitude and phased
		phase = self.GetReferencePhase()[0]
		ampl = np.ones(phase.size)
		ampl, phase = self.DevPulseShaper.GetUnwrappedAmplPhase(ampl, phase) 
		
		# Wrap the phase in radians
		phase %= (2*np.pi)
		
		# Get the phase in unites of 2*pi
		phase /= (2*np.pi)
		
		visvis.subplot(211)
		visvis.plot(phase)
		visvis.ylabel ('Reference phase')
		visvis.xlabel ('puls shaper pixel number')
		visvis.title ('Current reference phase (in unites of 2*pi)')
		
		visvis.subplot(212)
		visvis.plot( self.corrections, lc='r',ms='*', mc='r' )
		visvis.ylabel ('Value of coefficients')
		visvis.xlabel ('coefficient number')
		visvis.title ('Value of corrections')
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:28,代码来源:miips_tab.py


示例2: draw

    def draw( self ):
            """Draw data."""
            if len(self.fitResults) == 0:
                return
            
            # Make sure our figure is the active one
            vv.figure(self.fig.nr)
            
            if not hasattr( self, 'subplot1' ):
                self.subplot1 = vv.subplot(211)
                #self.subplot1.position = (30, 2, -32, -32)
                self.subplot2 = vv.subplot(212)
                #self.subplot1.position = (30, 2, -32, -32)

            

            a, ed = numpy.histogram(self.fitResults['tIndex'], self.Size[0]/6)
            print((float(numpy.diff(ed[:2]))))

            self.subplot1.MakeCurrent()
            vv.cla()
            vv.plot(ed[:-1], a/float(numpy.diff(ed[:2])), lc='b', lw=2)
            #self.subplot1.set_xticks([0, ed.max()])
            #self.subplot1.set_yticks([0, numpy.floor(a.max()/float(numpy.diff(ed[:2])))])
            self.subplot2.MakeCurrent()
            vv.cla()
            #cs =
            csa = numpy.cumsum(a)
            vv.plot(ed[:-1], csa/float(csa[-1]), lc='g', lw=2)
            #self.subplot2.set_xticks([0, ed.max()])
            #self.subplot2.set_yticks([0, a.sum()])

            self.fig.DrawNow()
            self.subplot1.position = (20, 2, -22, -32)
            self.subplot2.position = (20, 2, -22, -32)
开发者ID:RuralCat,项目名称:CLipPYME,代码行数:35,代码来源:progGraphVV.py


示例3: compareGraphsVisually

def compareGraphsVisually(graph1, graph2, fig=None):
    """ compareGraphsVisually(graph1, graph2, fig=None)
    Show the two graphs together in a figure. Matched nodes are
    indicated by lines between them.
    """
    
    # Get figure
    if isinstance(fig,int):
        fig = vv.figure(fig)
    elif fig is None:
        fig = vv.figure()
    
    # Prepare figure and axes
    fig.Clear()
    a = vv.gca()
    a.cameraType = '3d'; a.daspectAuto = False
    
    # Draw both graphs
    graph1.Draw(lc='b', mc='b')
    graph2.Draw(lc='r', mc='r')
    
    # Set the limits
    a.SetLimits()
    
    # Make a line from the edges
    pp = Pointset(3)
    for node in graph1:
        if hasattr(node, 'match') and node.match is not None:
            pp.append(node); pp.append(node.match)
    
    # Plot edges
    vv.plot(pp, lc='g', ls='+')
开发者ID:turapeach,项目名称:TOAK,代码行数:32,代码来源:graph.py


示例4: DisplayOptimization

	def DisplayOptimization (self) :
		"""
		Display the progress of optimization
		"""
		wx.Yield()
		# abort, if requested 
		if self.need_abort : return
	
		def GetValueColourIter (d) :
			return izip_longest( d.itervalues(), ['r', 'g', 'b', 'k'],  fillvalue='y' )
	
		visvis.cla(); visvis.clf()
		visvis.subplot(211)
		
		# Plot optimization statistics
		for values, colour in GetValueColourIter(self.optimization_log) :
			try : visvis.plot ( values, lc=colour ) 
			except Exception : pass
		
		visvis.xlabel ('iteration')
		visvis.ylabel ('Objective function')
		visvis.legend( self.optimization_log.keys() )
		
		# Display reference signal
		visvis.subplot(212)
			
		# Plot reference signal
		for values, colour in GetValueColourIter(self.log_reference_signal) :
			try : visvis.plot ( values, lc=colour ) 
			except Exception : pass
		
		visvis.xlabel ('iteration')
		visvis.ylabel ("Signal from reference pulse")
		visvis.legend( ["channel %d" % x for x in self.log_reference_signal.keys()] )
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:34,代码来源:odd_tab.py


示例5: set_plot

    def set_plot(self, spectrum):
        self.clear_plots()

        total = len(spectrum)
        count = 0.
        for _time, sweep in spectrum.items():
            if self.settings.fadeScans:
                alpha = (count + 1) / total
            vv.plot(sweep.keys(), sweep.values(), lw=1., alpha=alpha)
            count += 1
开发者ID:PatMart,项目名称:RTLSDR-Scanner,代码行数:10,代码来源:plot_preview.py


示例6: plot_point_set

 def plot_point_set(self, new_point, color, length, i=False):
     points = self.points_i if i else self.points
     # appending new point and drop old if window is full
     points[0].append(new_point[0])
     points[1].append(new_point[1])
     points[0] = points[0][length:]
     points[1] = points[1][length:]
     vv.plot(points[0], points[1], lw=0, mw=1, ms='.', mc=color, mec=color)
     if i:
         self.points_i = points
     else:
         self.points = points
开发者ID:LeaFin,项目名称:meissner-oszillator,代码行数:12,代码来源:meissner_oszillator.py


示例7: _Plot

 def _Plot(self, event):
     
     # Make sure our figure is the active one
     # If only one figure, this is not necessary.
     #vv.figure(self.fig.nr)
     
     # Clear it
     vv.clf()
     
     # Plot
     vv.plot([1,2,3,1,6])
     vv.legend(['this is a line'])        
开发者ID:chiluf,项目名称:visvis.dev,代码行数:12,代码来源:embeddingInFLTK.py


示例8: __plot

    def __plot(self, spectrum):
        vv.clf()
        axes = vv.gca()
        axes.axis.showGrid = True
        axes.axis.xLabel = 'Frequency (MHz)'
        axes.axis.yLabel = 'Level (dB)'

        total = len(spectrum)
        count = 0.
        for _time, sweep in spectrum.items():
            alpha = (total - count) / total
            vv.plot(sweep.keys(), sweep.values(), lw=1, alpha=alpha)
            count += 1
开发者ID:PatMart,项目名称:RTLSDR-Scanner,代码行数:13,代码来源:rtlsdr_scan_view.py


示例9: ScanVoltage

	def ScanVoltage (self) :
		"""
		Using the iterator <self.scan_pixel_voltage_pair> record the spectral response 
		by applying the voltages
		"""
		# Pause calibration, if user requested
		try : 
			if self.pause_calibration : return
		except AttributeError : return
				
		try :
			param = self.scan_pixel_voltage_pair.next()
			self.PulseShaper.SetUniformMasks(*param)
			
			# Getting spectrum
			spectrum = self.Spectrometer.AcquiredData() 
			# Save the spectrum
			try : self.SpectraGroup["voltages_%d_%d" % param] = spectrum
			except RuntimeError : print "There was RuntimeError while saving scan voltages_%d_%d" % param
			
			# Plot the spectra
			visvis.gca().Clear()
			
			visvis.plot (self.wavelengths, spectrum)
			visvis.xlabel("wavelength (nm)")
			visvis.ylabel("counts")
			
			# Scanning progress info
			self.scanned += 1.
			percentage_completed = 100.*self.scanned/self.scan_length
			seconds_left = ( time.clock() - self.initial_time )*(100./percentage_completed - 1.)
			# convert to hours:min:sec
			m, s = divmod(seconds_left, 60)
			h, m = divmod(m, 60)
			
			title_info = param + (percentage_completed, h, m, s)
			visvis.title ("Scanning spectrum by applying voltages %d/%d. Progress: %.1f%% completed. Time left: %d:%02d:%02d." %  title_info)
			
			self.fig.DrawNow()
			
			# Measure the next pair
			wx.CallAfter(self.ScanVoltage)
		except StopIteration :
			# Perform processing of the measured data
			wx.CallAfter(self.ExtractPhaseFunc, filename=self.calibration_file.filename)
			# All voltages are scanned
			self.StopAllJobs()
			# Sop using the shaper
			self.PulseShaper.StopDevice()
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:49,代码来源:calibrate_shaper.py


示例10: _call_new_item

 def _call_new_item(self, key, item_type, *args, **kwargs):
     if key in self.items:
         # an item with that key already exists
         # should raise an exception or warning
         pass
     else:
         # make this the current figure
         vv.figure(self.figure)
         # create a new dictionary of options for plotting
         plot_kwargs = dict()
         if 'line_width' in kwargs:
             value = kwargs.pop('line_width')
             plot_kwargs['lw'] = value
         if 'marker_width' in kwargs:
             value = kwargs.pop('marker_width')
             plot_kwargs['mw'] = value
         if 'marker_edge_width' in kwargs:
             value = kwargs.pop('marker_edge_width')
             plot_kwargs['mew'] = value
         if 'line_color' in kwargs:
             value = kwargs.pop('line_color')
             plot_kwargs['lc'] = value
         if 'marker_color' in kwargs:
             value = kwargs.pop('marker_color')
             plot_kwargs['mc'] = value
         if 'marker_edge_color' in kwargs:
             value = kwargs.pop('marker_edge_color')
             plot_kwargs['mec'] = value
         if 'line_style' in kwargs:
             value = kwargs.pop('line_style')
             plot_kwargs['ls'] = value
         if 'marker_style' in kwargs:
             value = kwargs.pop('marker_style')
             plot_kwargs['ms'] = value
         if 'adjust_axes' in kwargs:
             value = kwargs.pop('adjust_axes')
             plot_kwargs['axesAdjust'] = value
         # create the plot item
         if item_type == 'circular':
             data = pythics.lib.CircularArray(cols=2, length=kwargs['length'])
             item = vv.plot(np.array([]), np.array([]), axes=self.axes, **plot_kwargs)
         elif item_type == 'growable':
             data = pythics.lib.GrowableArray(cols=2, length=kwargs['length'])
             item = vv.plot(np.array([]), np.array([]), axes=self.axes, **plot_kwargs)
         else:
             data = np.array([])
             item = vv.plot(np.array([]), np.array([]), axes=self.axes, **plot_kwargs)
         self.items[key] = (item_type, data, item)
开发者ID:avelo,项目名称:Pythics,代码行数:48,代码来源:vv.py


示例11: OnDown

    def OnDown(self, event):
        """ Called when the mouse is pressed down in the axes.
        """

        # Only process left mouse button
        if event.button != 1:
            return False

        # Store location
        self._active = Point(event.x2d, event.y2d)

        # Clear temp line object
        if self._line1:
            self._line1.Destroy()

        # Create line objects
        tmp = Pointset(2)
        tmp.append(self._active)
        tmp.append(self._active)
        self._line1 = vv.plot(tmp, lc="r", lw="1", axes=self._a, axesAdjust=0)

        # Draw
        self._a.Draw()

        # Prevent dragging by indicating the event needs no further handling
        return True
开发者ID:gwdgithubnom,项目名称:visvis,代码行数:26,代码来源:drawing.py


示例12: __init__

    def __init__(self):

        # Create figure and axes
        vv.figure()
        self._a = a = vv.gca()
        vv.title("Hold mouse to draw lines. Use 'rgbcmyk' and '1-9' keys.")

        # Set axes
        a.SetLimits((0, 1), (0, 1))
        a.cameraType = "2d"
        a.daspectAuto = False
        a.axis.showGrid = True

        # Init variables needed during drawing
        self._active = None
        self._pp = Pointset(2)

        # Create null and empty line objects
        self._line1 = None
        self._line2 = vv.plot(vv.Pointset(2), ls="+", lc="c", lw="2", axes=a)

        # Bind to events
        a.eventMouseDown.Bind(self.OnDown)
        a.eventMouseUp.Bind(self.OnUp)
        a.eventMotion.Bind(self.OnMotion)
        a.eventKeyDown.Bind(self.OnKey)
开发者ID:gwdgithubnom,项目名称:visvis,代码行数:26,代码来源:drawing.py


示例13: kde

def kde(data, bins=None, kernel=None, **kwargs):
    """ kde(a, bins=None, range=None, **kwargs)
    
    Make a kernerl density estimate plot of the data. This is like a 
    histogram, but produces a smoother result, thereby better represening
    the probability density function.
    
    See the vv.StatData for more statistics on data.
    
    Parameters
    ----------
    a : array_like
        The data to calculate the historgam of.
    bins : int (optional)
        The number of bins. If not given, the best number of bins is 
        determined automatically using the Freedman-Diaconis rule.
    kernel : float or sequence (optional)
        The kernel to use for distributing the values. If a scalar is given,
        a Gaussian kernel with a sigma equal to the given number is used.
        If not given, the best kernel is chosen baded on the number of bins.
    kwargs : keyword arguments
        These are given to the plot function.
    
    """

    # Get stats
    from visvis.processing.statistics import StatData

    stats = StatData(data)

    # Get kde
    xx, values = stats.kde(bins, kernel)

    # Plot
    return vv.plot(xx, values, **kwargs)
开发者ID:chiluf,项目名称:visvis.dev,代码行数:35,代码来源:kde.py


示例14: DrawSpectrum

	def DrawSpectrum (self, event) :
		"""
		Draw spectrum interactively
		"""		
		spectrum = self.Spectrometer.AcquiredData() 
		if spectrum == RETURN_FAIL : return
		# Display the spectrum
		if len(spectrum.shape) > 1:
			try :
				self.__interact_2d_spectrum__.SetData(spectrum)
			except AttributeError :
				visvis.cla(); visvis.clf(); 	
				# Spectrum is a 2D image
				visvis.subplot(211)
				self.__interact_2d_spectrum__ = visvis.imshow(spectrum, cm=visvis.CM_JET)
				visvis.subplot(212)
				
			# Plot a vertical binning
			spectrum = spectrum.sum(axis=0)
			
		# Linear spectrum
		try :
			self.__interact_1d_spectrum__.SetYdata(spectrum)	
		except AttributeError :
			if self.wavelengths is None : 
				self.__interact_1d_spectrum__ = visvis.plot (spectrum, lw=3)
				visvis.xlabel ("pixels")
			else : 
				self.__interact_1d_spectrum__ = visvis.plot (self.wavelengths, spectrum, lw=3)
				visvis.xlabel("wavelength (nm)")
			visvis.ylabel("counts")
			
		if self.is_autoscaled_spectrum :
			# Smart auto-scale linear plot
			try :
				self.spectrum_plot_limits = GetSmartAutoScaleRange(spectrum, self.spectrum_plot_limits)
			except AttributeError :
				self.spectrum_plot_limits = GetSmartAutoScaleRange(spectrum)
		
		visvis.gca().SetLimits ( rangeY=self.spectrum_plot_limits )
		
		# Display the current temperature
		try : visvis.title ("Temperature %d (C)" % self.Spectrometer.GetTemperature() )
		except AttributeError : pass
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:44,代码来源:basic_window.py


示例15: Draw

 def Draw(self, mc='g', lc='y', mw=7, lw=0.6, alpha=0.5, axes=None):
     """ Draw(mc='g', lc='y', mw=7, lw=0.6, alpha=0.5, axes=None)
     Draw nodes and edges. 
     """ 
     
     # We can only draw if we have any nodes
     if not len(self):
         return
     
     # Make sure there are elements in the lines list
     while len(self._lines)<2:
         self._lines.append(None)
     
     # Build node list
     if mc and mw:
         pp = Pointset(self[0].ndim)
         for p in self:
             pp.append(p)
         # Draw nodes, reuse if possible!
         l_node = self._lines[0]            
         if l_node and len(l_node._points) == len(pp):
             l_node.SetPoints(pp)
         elif l_node:
             l_node.Destroy()
             l_node = None
         if l_node is None:                
             l_node = vv.plot(pp, ls='', ms='o', mc=mc, mw=mw, 
                 axesAdjust=0, axes=axes, alpha=alpha)
             self._lines[0] = l_node
     
     # For simplicity, always redraw edges
     if self._lines[1] is not None: 
         self._lines[1].Destroy()
     
     # Build edge list
     if lc and lw:
         cc = self.GetEdges()
         # Draw edges
         pp = Pointset(self[0].ndim)
         for c in cc:            
             pp.append(c.end1); pp.append(c.end2)
         tmp = vv.plot(pp, ms='', ls='+', lc=lc, lw=lw, 
             axesAdjust=0, axes=axes, alpha=alpha)
         self._lines[1] = tmp
开发者ID:turapeach,项目名称:TOAK,代码行数:44,代码来源:graph.py


示例16: draw_spectrum

			def draw_spectrum (event) :
				"""Timer function """
				spectrum = self.Spectrometer.AcquiredData() 
				if spectrum == RETURN_FAIL : return
				# Display the spectrum
				
				############### Take the log of spectrum ##########
				#spectrum = spectrum / float(spectrum.max())
				#np.log10(spectrum, out=spectrum)
				##############################
				
				ax = visvis.gca()
				ax.Clear()	
				visvis.plot (self.wavelengths, spectrum)
				visvis.xlabel("wavelength (nm)")
				visvis.ylabel("counts")
				
				# Display the current temperature
				visvis.title ("Temperature %d (C)" % self.Spectrometer.GetTemperature() )
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:19,代码来源:main.py


示例17: _Plot

    def _Plot(self, event):
        # Make sure our figure is the active one
        # If only one figure, this is not necessary.
        # vv.figure(self.fig.nr)

        # Clear it
        vv.clf()

        song = wave.open("C:\Users\Mario\Desktop\infoadex antonio\\20150617070001.wav", 'r')
        frames = song.getnframes()
        ch = song.getnchannels()
        song_f = song.readframes(ch*frames)
        data = np.fromstring(song_f, np.int16)

        print data

        # Plot
        # vv.plot([1,2,3,1,6])
        vv.plot(data)
        vv.legend(['this is a line'])
开发者ID:Edasn,项目名称:CaptorRadio-v2,代码行数:20,代码来源:visualizador_visvis.py


示例18: ShowSpectra_by_VaryingPixelBundle

	def ShowSpectra_by_VaryingPixelBundle (self) :
		"""
		This method is affiliated to the method <self.VaryPixelBundle>
		"""
		# Exit if the iterator is not defined
		try : self.pixel_bundel_value_iter
		except AttributeError : return
		
		try :
			voltage = self.pixel_bundel_value_iter.next()
			
			# Set the mask for pixel bundle
			width = self.SettingsNotebook.CalibrateShaper.pixel_bundle_width.GetValue() / 2
			start_pixel_bundle = self.pixel_to_vary.GetValue()
			mask = np.copy(self.fixed_mask)
			if width:
				mask[max(start_pixel_bundle-width, 0):min(mask.size, start_pixel_bundle+width)] = voltage
			else:
				# Enforce single pixel width
				mask[min(max(start_pixel_bundle,0),mask.size)] = voltage	
			self.PulseShaper.SetMasks( mask, self.fixed_mask)
		
			# Getting spectrum
			spectrum = self.Spectrometer.AcquiredData()
		
			# Plot the spectra
			visvis.gca().Clear()
			visvis.plot (self.wavelengths, spectrum)
			visvis.xlabel("wavelength (nm)")
			visvis.ylabel("counts")
			visvis.title ("Voltage %d / %d " % (voltage, self.fixed_mask[0]) )
			self.fig.DrawNow()
			
			# Going to the next iteration
			wx.CallAfter (self.ShowSpectra_by_VaryingPixelBundle)
		except StopIteration :
			# Finish the job
			self.StopAllJobs()
开发者ID:dibondar,项目名称:PyPhotonicReagents,代码行数:38,代码来源:calibrate_shaper.py


示例19: _Plot

    def _Plot(self, event):
        
        # update status text
        self.status.SetLabel("CPU:%.1f\nMemory:%.1f" % (cpudata[-1], vmemdata[-1]))
        # Make sure our figure is the active one
        # If only one figure, this is not necessary.
        #vv.figure(self.fig.nr)
        
        # Clear it
        vv.clf()
        
        # Plot
        a = vv.subplot(211)
        vv.plot(cpudata, lw=2, lc="c", mc ='y', ms='d')
        vv.legend("cpu percent ")
        a.axis.showGrid = True
        a.axis.xlabel = "CPU Usage Percent"
        a.axis.ylabel = "sampling time line"

        a = vv.subplot(212)
        vv.plot(vmemdata, lw=2, mew=1, lc='m', mc ='y', ms='d' )
        vv.legend("virtual memory")
        a.axis.showGrid = True
开发者ID:oligo,项目名称:indicator,代码行数:23,代码来源:indicator.py


示例20: ginput

def ginput(N=0, axes=None, ms='+', **kwargs):
    """ ginput(N=0, axes=None, ms='+', **kwargs)
    
    Graphical input: select N number of points with the mouse. 
    Returns a 2D pointset.
    
    Parameters
    ----------
    N : int
        The maximum number of points to capture. If N=0, will keep capturing
        until the user stops it. The capturing always stops when enter is
        pressed or the mouse is double clicked. In the latter case a final
        point is added.
    axes : Axes instance
        The axes to capture the points in, or the current axes if not given.
    ms : markerStyle
        The marker style to use for the points. See plot.
    
    Any other keyword arguments are passed to plot to show the selected
    points and the lines between them.
    
    """
    
    # Get axes
    if not axes:
        axes = vv.gca()
    
    # Get figure
    fig = axes.GetFigure()
    if not fig:
        return
    
    # Init pointset, helper, and line object
    line = vv.plot(Pointset(2), axes=axes, ms=ms, **kwargs)    
    pp = line._points
    ginputHelper.Start(axes, pp, N)
    
    # Enter a loop
    while ginputHelper.axes:
        fig._ProcessGuiEvents()
        time.sleep(0.1)
    
    # Remove line object and return points
    pp = Pointset(pp[:,:2])
    line.Destroy()
    return pp
开发者ID:binaryannamolly,项目名称:visvis,代码行数:46,代码来源:ginput.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python visvis.use函数代码示例发布时间:2022-05-26
下一篇:
Python visvis.gca函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap