Package gmisclib :: Module pylab_oneaxis
[frames] | no frames]

Source Code for Module gmisclib.pylab_oneaxis

 1  #!/usr/bin/env python 
 2  """ 
 3  You can control the axis tick and grid properties 
 4  """ 
 5  import pylab 
 6  import sys 
 7  import Num 
 8   
9 -def plot_oneaxis(dlist):
10 """dlist is a list of (label, (ctr, uerr, derr)).""" 11 pylab.figure() 12 ax = pylab.subplot(111) 13 ax.set_yticks( [ pos[0] for (lab,pos) in dlist ] ) 14 ax.set_yticklabels( [ lab for (lab,pos) in dlist ] ) 15 ax.set_xticks( [] ) 16 ax.set_xticklabels( [] ) 17 regions = [] 18 y = [] 19 err = [] 20 x = [] 21 for (lab, (ctr, uerr, derr)) in dlist: 22 y.append(ctr) 23 err.append((derr,uerr)) 24 xj = 0.5 25 for (l,h,xi) in regions: 26 if l <= ctr <= h: 27 xj += 1 28 regions.append((ctr-1.3*derr, ctr+1.3*uerr, xj)) 29 x.append(xj) 30 pylab.errorbar(x=Num.array(x), y=Num.array(y), 31 yerr=Num.array(err) 32 )
33 34 35 36 37 38 if __name__ == '__main__': 39 (d,c,x) = process(sys.stdin) 40 41 plot_oneaxis(dlist) 42 pylab.show() 43