def plot(self, output=None):
"""
Plot the statistics.
INPUT: None
OUTPUT: None
SIDE EFFECTS: Generates a plot, depending on the output mode of pylab
this may open a ne window.
"""
fig = pylab.figure()
ax1 = fig.add_subplot(111)
ax1.set_xlabel(self.mode[1])
ax1.set_ylabel('MB/s')
ax1.set_xlim([0,self.loop+0.5])
ax1.bar(where(self.y>=0)[0]+0.1,self.y)
ax1.xaxis.axes.set_autoscalex_on(False)
ax1.plot([0,self.loop+0.5],[median(self.y[where(self.y > 0)]),
median(self.y[where(self.y > 0)])])
ax1.plot([0,self.loop+0.5],[mean(self.y[where(self.y > 0)]),
mean(self.y[where(self.y > 0)])])
pylab.text(0.02,0.95,'Median: %5.2f MB/s'
% median(self.y[where(self.y > 0)]),
transform = ax1.transAxes,ha='left', va='bottom', color='b',
fontsize=10)
pylab.text(0.02,0.95,'Mean: %5.2f MB/s'
% mean(self.y[where(self.y > 0)]),
transform = ax1.transAxes,ha='left', va='top', color='g',
fontsize=10)
ax2 = ax1.twinx()
ax2.xaxis.axes.set_autoscalex_on(False)
ax2.plot(where(self.n>=0)[0]+0.5,self.n,'r-', marker='o')
for tl in ax2.get_yticklabels():
tl.set_color('r')
ax2.set_ylabel('Number of files',{'color':'r'})
if self.mode[1] == 'Day':
fig.canvas.set_window_title('%s: %s' % (self.db,self.date))
ax2.set_title('%s %s ingest rate: %s' % (self.db, self.mode[0], self.date))
else:
fig.canvas.set_window_title('%s: %s' % (self.db,self.date))
ax2.set_title('%s %s ingest rate: %s' % (self.db, self.mode[0], self.date))
pylab.text(0.99,0.95,'Total: %5.2f TB' % self.tvol,transform = ax1.transAxes,ha='right', va='bottom')
pylab.text(0.99,0.95,'Total # files: %8d' % self.tfils,transform = ax1.transAxes,ha='right', va='top')
if (output is not None):
fig.savefig(output)
else:
fig.show()
#pl.close(fig)
评论列表
文章目录