Revision a60088f6 lib/plot_utilities.py

View differences:

lib/plot_utilities.py
138 138
	if tit:
139 139
		plt.title(tit)
140 140

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

  
144 144
	sb.yaxis.tick_left()
145 145
	sb.yaxis.set_label_position("left")
146 146
#	sb.set_ylim([0,1])
147 147
#	plot1 = sb.plot(b[:-1],h,label="Frequency distribution")
148
	plot1 = sb.plot(b[:-1],h)
148
	plot1 = sb.plot(b[:-1],h,linewidth=2,color='blue',linestyle=linestyle)
149 149
	if log_scale:
150 150
		sb.set_xscale('log')
151 151
	plt.legend(loc='lower right')
152
	plt.ylabel("Number of samples")
152
	if ylabel:
153
		plt.ylabel(ylabel)
154
	else:
155
		plt.ylabel("Number of samples")
153 156
	plt.xlabel(xlabel)
154 157
	sb.set_ylim([0,max(h)])
155 158

  
......
162 165
	sbSum.yaxis.tick_right()
163 166
	sbSum.yaxis.set_label_position("right")
164 167
	sbSum.set_ylim([0,1])
165
	plot2 = sbSum.plot(b[:-1], (np.array(sumSamples)/sum(h)),color='green')
168
	plot2 = sbSum.plot(b[:-1], (np.array(sumSamples)/sum(h)),color='black',linewidth=2,linestyle=linestyle)
166 169
	#plot2 = sbSum.plot(b[:-1], (np.array(sumSamples)/sum(h)),color='green',label="Integral")
167 170
	if log_scale:
168 171
		sb.set_xscale('log')
169 172

  
170
	plt.title(title)
173
	if title:
174
		plt.title(title)
171 175
	plt.ylabel("Probability")
172 176
	plt.legend(loc='upper right')
173 177
	sbSum.yaxis.grid(color='gray', linestyle='dashed')

Also available in: Unified diff