Revision c39a768e lib/plot_utilities.py

View differences:

lib/plot_utilities.py
4 4
import colorsys 
5 5
import struct
6 6

  
7
def plotOrderedErrorBar(x,y,yerr=None,xlab=None,ylab=None,tit=None):
8
	perm = sorted(range(len(y)), key=lambda k: y[k])
7
def plotOrderedErrorBar(x,y,yerr=None,xlab=None,ylab=None,tit=None,label=None,on_x=False):
8
	if on_x:
9
	  perm = sorted(range(len(x)), key=lambda k: x[k])
10
	else:
11
		perm = sorted(range(len(y)), key=lambda k: y[k])
9 12
	x = [x[i] for i in perm]
10 13
	y = [y[i] for i in perm]
11 14
	if yerr != None:
12 15
		yerr = [yerr[i] for i in perm]
13 16

  
14
	plt.plot(range(0,len(x)), y, linestyle="dashed", marker="o", color="green")
17
	if label:
18
		plt.plot(range(0,len(x)), y,label=label, linestyle="dashed", marker="o")
19
	else:
20
		plt.plot(range(0,len(x)), y, linestyle="dashed", marker="o")
21

  
15 22
	plt.errorbar(range(0,len(x)),y,yerr = yerr, linestyle="None", marker="None", color="green")
16
	plt.xticks(range(0,len(x)),x,rotation=90)
23
	plt.xticks(range(0,len(x)),x)
17 24
	plt.xlim(-1,len(x))
18 25
	plt.grid()
19 26
	if xlab:
......
138 145
	if tit:
139 146
		plt.title(tit)
140 147

  
148
def plotDictAsBox(f,dicto):
149
	#print dicto
150
	values = dicto.values()
151
	x = dicto.keys()
152
	ax = f.add_subplot(111)
153
	bp = ax.boxplot(values)
154
	ax.set_xticklabels(x)
155
	plt.xticks(rotation=90)
156

  
141 157
def plotHistFrequencies(h,b,xlabel,title=None,log_scale=False,ylabel=None,linestyle='-'):
142 158
	sb = plt.subplot(1,1,1)
143 159

  

Also available in: Unified diff