本文整理汇总了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