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


Python pylab.axes方法代码示例

本文整理汇总了Python中pylab.axes方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.axes方法的具体用法?Python pylab.axes怎么用?Python pylab.axes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylab的用法示例。


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

示例1: image_click_xshift

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def image_click_xshift(axes = "gca"):
    """
    Takes a starting and ending point, then shifts the image y by this amount
    """
    if axes == "gca": axes = _pylab.gca()

    try:
        p1 = _pylab.ginput()
        p2 = _pylab.ginput()

        xshift = p2[0][0]-p1[0][0]

        e = axes.images[0].get_extent()

        e[0] = e[0] + xshift
        e[1] = e[1] + xshift

        axes.images[0].set_extent(e)

        _pylab.draw()
    except:
        print("whoops") 
开发者ID:Spinmob,项目名称:spinmob,代码行数:24,代码来源:_pylab_tweaks.py

示例2: image_shift

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def image_shift(xshift=0, yshift=0, axes="gca"):
    """
    This will shift an image to a new location on x and y.
    """

    if axes=="gca": axes = _pylab.gca()

    e = axes.images[0].get_extent()

    e[0] = e[0] + xshift
    e[1] = e[1] + xshift
    e[2] = e[2] + yshift
    e[3] = e[3] + yshift

    axes.images[0].set_extent(e)

    _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:19,代码来源:_pylab_tweaks.py

示例3: image_set_clim

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def image_set_clim(zmin=None, zmax=None, axes="gca"):
    """
    This will set the clim (range) of the colorbar.

    Setting zmin or zmax to None will not change them.
    Setting zmin or zmax to "auto" will auto-scale them to include all the data.
    """
    if axes=="gca": axes=_pylab.gca()

    image = axes.images[0]

    if zmin=='auto': zmin = _n.min(image.get_array())
    if zmax=='auto': zmax = _n.max(image.get_array())

    if zmin==None: zmin = image.get_clim()[0]
    if zmax==None: zmax = image.get_clim()[1]

    image.set_clim(zmin, zmax)

    _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:22,代码来源:_pylab_tweaks.py

示例4: integrate_shown_data

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def integrate_shown_data(scale=1, fyname=1, autozero=0, **kwargs):
    """
    Numerically integrates the data visible on the current/specified axes using
    scale*fun.integrate_data(x,y). Modifies the visible data using
    manipulate_shown_data(**kwargs)

    autozero is the number of data points used to estimate the background
    for subtraction. If autozero = 0, no background subtraction is performed.
    """

    def I(x,y):
        xout, iout = _fun.integrate_data(x, y, autozero=autozero)
        print("Total =", scale*iout[-1])
        return xout, scale*iout

    if fyname==1: fyname = "$"+str(scale)+"\\times \\int dx$"

    manipulate_shown_data(I, fxname=None, fyname=fyname, **kwargs) 
开发者ID:Spinmob,项目名称:spinmob,代码行数:20,代码来源:_pylab_tweaks.py

示例5: reverse_draw_order

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def reverse_draw_order(axes="current"):
    """

    This function takes the graph and reverses the draw order.

    """

    if axes=="current": axes = _pylab.gca()

    # get the lines from the plot
    lines = axes.get_lines()

    # reverse the order
    lines.reverse()

    for n in range(0, len(lines)):
        if isinstance(lines[n], _mpl.lines.Line2D):
            axes.lines[n]=lines[n]

    _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:22,代码来源:_pylab_tweaks.py

示例6: set_all_line_attributes

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def set_all_line_attributes(attribute="lw", value=2, axes="current", refresh=True):
    """

    This function sets all the specified line attributes.

    """

    if axes=="current": axes = _pylab.gca()

    # get the lines from the plot
    lines = axes.get_lines()

    # loop over the lines and trim the data
    for line in lines:
        if isinstance(line, _mpl.lines.Line2D):
            _pylab.setp(line, attribute, value)

    # update the plot
    if refresh: _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:21,代码来源:_pylab_tweaks.py

示例7: smooth_all_traces

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def smooth_all_traces(smoothing=1, trim=True, axes="gca"):
    """

    This function does nearest-neighbor smoothing of the data

    """
    if axes=="gca": axes=_pylab.gca()

    # get the lines from the plot
    lines = axes.get_lines()

    # loop over the lines and trim the data
    for line in lines:
        if isinstance(line, _mpl.lines.Line2D):
            smooth_line(line, smoothing, trim, draw=False)
    _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:18,代码来源:_pylab_tweaks.py

示例8: line_math

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def line_math(fx=None, fy=None, axes='gca'):
    """
    applies function fx to all xdata and fy to all ydata.
    """

    if axes=='gca': axes = _pylab.gca()

    lines = axes.get_lines()

    for line in lines:
        if isinstance(line, _mpl.lines.Line2D):
            xdata, ydata = line.get_data()
            if not fx==None: xdata = fx(xdata)
            if not fy==None: ydata = fy(ydata)
            line.set_data(xdata,ydata)

    _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:19,代码来源:_pylab_tweaks.py

示例9: apply

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def apply(self, axes="gca"):
        """
        Applies the style cycle to the lines in the axes specified
        """

        if axes == "gca": axes = _pylab.gca()
        self.reset()
        lines = axes.get_lines()

        for l in lines:
            l.set_color(self.get_line_color(1))
            l.set_mfc(self.get_face_color(1))
            l.set_marker(self.get_marker(1))
            l.set_mec(self.get_edge_color(1))
            l.set_linestyle(self.get_linestyle(1))

        _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:19,代码来源:_pylab_tweaks.py

示例10: __init__

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def __init__(self, norder = 2):
		"""Initializes the class when returning an instance. Pass it the polynomial order. It will 
set up two figure windows, one for the graph the other for the coefficent interface. It will then initialize 
the coefficients to zero and plot the (not so interesting) polynomial."""
		
		self.order = norder
		
		self.c = M.zeros(self.order,'f')
		self.ax = [None]*(self.order-1)#M.zeros(self.order-1,'i') #Coefficent axes
		
		self.ffig = M.figure() #The first figure window has the plot
		self.replotf()
		
		self.cfig = M.figure() #The second figure window has the 
		row = M.ceil(M.sqrt(self.order-1))
		for n in xrange(self.order-1):
			self.ax[n] = M.subplot(row, row, n+1)
			M.setp(self.ax[n],'label', n)
			M.plot([0],[0],'.')
			M.axis([-1, 1, -1, 1]);
			
		self.replotc()
		M.connect('button_press_event', self.click_event) 
开发者ID:ActiveState,项目名称:code,代码行数:25,代码来源:recipe-576501.py

示例11: click_event

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def click_event(self, event):
		"""Whenever a click occurs on the coefficent axes we modify the coefficents and update the 
plot"""
		
		if event.xdata is None:#we clicked outside the axis
			return

		idx = M.getp(event.inaxes,'label')
		
		print idx, event.xdata, event.ydata
				
		self.c[idx] = event.xdata
		self.c[idx+1] = event.ydata

		self.replotf()
		self.replotc() 
开发者ID:ActiveState,项目名称:code,代码行数:18,代码来源:recipe-576501.py

示例12: generateImages

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def generateImages(picklefile, pickledir, filehash, imagedir, pietype):

	leaf_file = open(os.path.join(pickledir, picklefile), 'rb')
	(piedata, pielabels) = cPickle.load(leaf_file)
	leaf_file.close()

	pylab.figure(1, figsize=(6.5,6.5))
	ax = pylab.axes([0.2, 0.15, 0.6, 0.6])

	pylab.pie(piedata, labels=pielabels)

	pylab.savefig(os.path.join(imagedir, '%s-%s.png' % (filehash, pietype)))
	pylab.gcf().clear()
	os.unlink(os.path.join(pickledir, picklefile)) 
开发者ID:armijnhemel,项目名称:binaryanalysis,代码行数:16,代码来源:piecharts.py

示例13: image_file

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def image_file(path=None, zscript='self[1:]', xscript='[0,1]', yscript='d[0]', g=None, **kwargs):
    """
    Loads an data file and plots it with color. Data file must have columns of the
    same length!

    Parameters
    ----------
    path=None
        Path to data file.
    zscript='self[1:]' 
        Determines how to get data from the columns
    xscript='[0,1]', yscript='d[0]' 
        Determine the x and y arrays used for setting the axes bounds
    g=None   
        Optional dictionary of globals for the scripts

    See spinmob.plot.image.data() for additional optional keyword arguments.
    See spinmob.data.databox.execute_script() for more information about scripts.
    """
    if 'delimiter' in kwargs: delimiter = kwargs.pop('delimiter')
    else:                           delimiter = None

    d = _data.load(paths=path, delimiter = delimiter)
    if d is None or len(d) == 0: return

    # allows the user to overwrite the defaults
    default_kwargs = dict(xlabel = str(xscript),
                          ylabel = str(yscript),
                          title  = d.path,
                          clabel = str(zscript))
    default_kwargs.update(kwargs)


    # get the data
    X = d(xscript, g)
    Y = d(yscript, g)
    Z = _n.array(d(zscript, g))
#    Z = Z.transpose()

    # plot!
    image_data(Z, X, Y, **default_kwargs) 
开发者ID:Spinmob,项目名称:spinmob,代码行数:43,代码来源:_plotting_mess.py

示例14: add_text

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def add_text(text, x=0.01, y=0.01, axes="gca", draw=True, **kwargs):
    """
    Adds text to the axes at the specified position.

    **kwargs go to the axes.text() function.
    """
    if axes=="gca": axes = _pylab.gca()
    axes.text(x, y, text, transform=axes.transAxes, **kwargs)
    if draw: _pylab.draw() 
开发者ID:Spinmob,项目名称:spinmob,代码行数:11,代码来源:_pylab_tweaks.py

示例15: differentiate_shown_data

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import axes [as 别名]
def differentiate_shown_data(neighbors=1, fyname=1, **kwargs):
    """
    Differentiates the data visible on the specified axes using
    fun.derivative_fit() (if neighbors > 0), and derivative() otherwise.
    Modifies the visible data using manipulate_shown_data(**kwargs)
    """

    if neighbors:
        def D(x,y): return _fun.derivative_fit(x,y,neighbors)
    else:
        def D(x,y): return _fun.derivative(x,y)

    if fyname==1: fyname = '$\\partial_{x(\\pm'+str(neighbors)+')}$'

    manipulate_shown_data(D, fxname=None, fyname=fyname, **kwargs) 
开发者ID:Spinmob,项目名称:spinmob,代码行数:17,代码来源:_pylab_tweaks.py


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