2011-11-22 275 views
3

我试图用matplot lib绘制我的数据。我有3个separetes组数据我想在3个次要情节绘制(我用this是我指导做好):在matplotlib中设置错误条的显示范围sup

plt.figure() 

fig, axs = plt.subplots(nrows=3, ncols = 1, sharex=False) 
ax1 = axs[0] 
ax1.errorbar(X,Y,Err,fmt='o') 
ax1.set_xscale('log') 
ax1.set_yscale('log') 
ax1.set_title('epsilon=1.5, kappa = 2') 
plt.show() 

但是我从1 X系列(或0,我不知道)到100,我想减少它。我试图this,通过添加:

ax1.xlim(0.5,13.5) 

但我得到一个错误:

AttributeError: 'AxesSubplot' object has no attribute 'xlim'

我怎样才能改变的范围呢?

回答

5

您可能需要使用Axes.axis(*v, **kwargs)

ax1.axis(xmin=0.5,xmax=13.5) 

从文档:

Set/Get the axis properties

If len(*v)==0, you can pass in xmin, xmax, ymin, ymax as kwargs selectively to alter just those limits without changing the others.

2

轴对象的对应方法是set_xlim(XMIN,XMAX)。