PageRenderTime 53ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/paper/plot-timing.py

http://github.com/brentp/cruzdb
Python | 43 lines | 29 code | 14 blank | 0 comment | 1 complexity | cfcaff8e089e1a181b57a7d036d0c9eb MD5 | raw file
  1. import pandas as pa
  2. import sys
  3. import matplotlib
  4. matplotlib.rc('font', **{'family': 'serif', 'serif': ['Times']})
  5. matplotlib.rc('text', **{'usetex': 'true'})
  6. from matplotlib import pyplot as plt
  7. import numpy as np
  8. plt.close()
  9. f, ax = plt.subplots(1, figsize=(3, 3))
  10. df = pa.read_table(sys.argv[1])
  11. pf = df.ix[~df.parallel]
  12. pt = df.ix[df.parallel]
  13. ax.set_ylabel('Intervals / Second')
  14. x = 0.1 + np.arange(3)
  15. width = 0.35
  16. rects0 = ax.bar(x, 3327. / pt.time, width, color='0.70', alpha=0.91)
  17. rects1 = ax.bar(x[:len(pf.time)] + width + 0.03, 3327. / pf.time, width,
  18. color='0.3', alpha=0.91)
  19. ax.set_xticks(x + width)
  20. ax.set_ylim(0, (3327. / min(pf.time)) + 50)
  21. ax.set_xticklabels(["%s\n%s" % tup for tup in zip(pt['loc'], pt.instance)],
  22. fontsize='x-small')
  23. legend = ax.legend((rects0[0], rects1[0]), ('parallel', 'not-parallel'))
  24. plt.setp(legend.get_texts(), fontsize='x-small')
  25. plt.setp(ax.get_yticklabels(), fontsize='x-small')
  26. plt.subplots_adjust(right=0.98, left=0.17, top=0.98, bottom=0.12)
  27. plt.savefig('manuscript-latex/figure1.eps')
  28. plt.savefig('manuscript-latex/figure1.pdf')
  29. plt.savefig('figure1.pdf')