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


Python Figure.xlim方法代码示例

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


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

示例1: comatic

# 需要导入模块: from matplotlib.figure import Figure [as 别名]
# 或者: from matplotlib.figure.Figure import xlim [as 别名]
def comatic(c2=.01, h=1.0, maxrho=4.0, maxtheta=2*np.math.pi, npoints=500.0, movie=False):
    if movie==False:
        arho = [x*maxrho/npoints for x in list(np.arange(npoints))]
        lx = []
        ly = []

        for rho in arho:
            atheta =  [x*maxtheta/(npoints) for x in list(np.arange(npoints))]
            for theta in atheta:
                lx.append(h+dx(c2=c2, h=h, theta=theta, rho=rho))
                ly.append(dy(c2=c2, h=h, theta=theta, rho=rho))
        print "plotting..."
    # Create a figure with size 6 x 6 inches.
        fig = Figure(figsize=(6,6))

# Create a canvas and add the figure to it.
        canvas = FigureCanvas(fig)

# Create a subplot.
        ax = fig.add_subplot(111)

# Set the title.
        ax.set_title('Comatic Aberation Scatter Plot',fontsize=14)

# Set the X Axis label.
        ax.set_xlabel('y[cm]',fontsize=12)

# Set the Y Axis label.
        ax.set_ylabel('x[cm]',fontsize=12)

# Display Grid.
        ax.grid(True,linestyle='-',color='0.75')

# Generate the Scatter Plot.
        ax.scatter(ly,lx,s=.05,color='tomato');

# Save the generated Scatter Plot to a PNG file.
        canvas.print_figure('ComaticAberationScatterPlot',dpi=500)
    if movie==True:
        arho = [x*maxrho/npoints for x in list(np.arange(npoints))]


        for rho in arho:
            lx = []
            ly = []
            atheta =  [x*maxtheta/(npoints) for x in list(np.arange(npoints))]
            for theta in atheta:
                lx.append(dx(c2=c2, h=h, theta=theta, rho=rho))
                ly.append(h + dy(c2=c2, h=h, theta=theta, rho=rho))
            print "plotting..." +str(rho)
    # Create a figure with size 6 x 6 inches.
            fig = Figure(figsize=(6,6))

# Create a canvas and add the figure to it.
            canvas = FigureCanvas(fig)

# Create a subplot.
            ax = fig.add_subplot(111)

# Set the title.
            ax.set_title('Comatic Aberation Scatter Plot',fontsize=14)

# Set the X Axis label.
            ax.set_xlabel('y[cm]',fontsize=12)

# Set the Y Axis label.
            ax.set_ylabel('x[cm]',fontsize=12)

# Display Grid.
            ax.grid(True,linestyle='-',color='0.75')

# Generate the Scatter Plot.
            ax.scatter(ly,lx,s=.05,color='tomato');
            fig.ylim((.9,1.6))
            fig.xlim((-.2,.2))
# Save the generated Scatter Plot to a PNG file.
            drho = rho/maxrho
            strguy = "%.04f" %drho
            strguy = strguy[2:]
            print 'ComaticAberationScatterPlot'+strguy
            canvas.print_figure('ComaticAberationScatterPlot'+strguy,dpi=500)
    return True
开发者ID:rasmodulus,项目名称:625-appliedoptics,代码行数:84,代码来源:comatic.py


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