# Changeset 2572 for hudson/performance/figure.py

Ignore:
Timestamp:
01/30/11 09:51:32 (5 years ago)
Message:

File:
1 edited

Unmodified
Removed
• ## hudson/performance/figure.py

 r2571 import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import os import os.path def plot_table(table): def plot_table(table, filename): #print table N = len(table)-1 pp = PdfPages(filename) #print "HERE", N, int(math.ceil(N/3.)), 3 fig, axs = plt.subplots(nrows=int(math.ceil(N/3.)), ncols=3, sharex=True) X = 0 Y = 0 for i in range(1,N+1): #print X,Y,axs ax = axs[X,Y] ax.set_title(table[i][0]) ax.plot(table[0][1:],table[i][1:]) ax.tick_params(direction='out') #print table[0][1:] #ax.axis(table[0][1:]) Y += 1 if Y == 3: if True: X = 1 for i in range(1,N+1): plt.subplot(5, 1, X) plt.plot(table[0][1:],table[i][1:]) plt.title(table[i][0], fontsize=8) plt.tick_params(labelsize=8) plt.subplots_adjust(wspace=0.5, hspace=0.5) ymin, ymax = plt.ylim() plt.ylim( (0, 1.05*ymax) ) X += 1 Y = 0 if X > 5: X = 0 plt.savefig(pp, format='pdf') plt.clf() else: X = 0 Y = 0 for i in range(1,N+1): if X == 0 and Y == 0: fig, axs = plt.subplots(nrows=4, ncols=2, sharex=True) ax = axs[X,Y] ax.set_title(table[i][0], fontsize=8) ax.plot(table[0][1:],table[i][1:]) ax.tick_params(labelsize=8) plt.subplots_adjust(wspace=0.5, hspace=0.5) Y += 1 if Y == 2: X += 1 Y = 0 if X == 4: X = 0 pp.savefig(fig) pp.close() def create_figure(csvfile, figfile): #print os.getcwd() table = read_table(csvfile) plot_table(table) print "Creating image file %s" % figfile plt.savefig(figfile) plot_table(table, figfile) if __name__ == '__main__': for file in sys.argv[1:]: create_figure(file, os.path.splitext(file)[0]+'.png') create_figure(file, os.path.splitext(file)[0]+'.pdf')
Note: See TracChangeset for help on using the changeset viewer.