performance.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python
  2. import sys
  3. import pandas as pd
  4. import matplotlib
  5. import matplotlib.pyplot as plt
  6. from matplotlib.lines import Line2D
  7. def main():
  8. set_plot_options()
  9. fig, axs = plt.subplots(1)
  10. columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  11. "ReTstdev", "ResponseHT", "RHTstdev"]
  12. df = pd.read_csv("standard_check"+".csv", usecols=columns)
  13. df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True)
  14. bridges = df.Bridges*2*3
  15. axs.set_xlabel('Blocked Bridges (%)')
  16. axs.set_ylabel('Response Time (ms)')
  17. axs.plot(df.Percent, df.ResponseT, color='#CC4F1B',
  18. label='Response Time for Percentage of Bridges Blocked')
  19. axs.set_ylim(bottom=0)
  20. axs.fill_between(df.Percent, df.ResponseT-df.ReTstdev,
  21. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B',
  22. facecolor='#FF9848')
  23. fig. tight_layout(pad=1)
  24. fig.savefig("StandardCheck.pdf")
  25. def set_plot_options():
  26. options = {
  27. #'backend': 'PDF',
  28. 'font.size': 18,
  29. 'figure.figsize': (7,3.5),
  30. 'figure.dpi': 100.0,
  31. 'axes.grid' : True,
  32. 'axes.xmargin' : 0,
  33. 'axes.grid.axis' : 'y',
  34. 'axes.axisbelow': True,
  35. 'axes.titlesize' : 'medium',
  36. 'axes.labelsize' : 'large',
  37. 'axes.formatter.limits': (-6,6),
  38. 'xtick.labelsize' : 18,#get_tick_font_size_10(),
  39. 'ytick.labelsize' : 18,
  40. 'lines.linewidth' : 2.0,
  41. 'lines.markersize' : 10,
  42. # turn on the following to embedd fonts; requires latex
  43. 'ps.useafm' : True,
  44. 'pdf.use14corefonts' : True,
  45. 'text.usetex' : False,
  46. }
  47. for option_key in options:
  48. matplotlib.rcParams[option_key] = options[option_key]
  49. if 'figure.max_num_figures' in matplotlib.rcParams:
  50. matplotlib.rcParams['figure.max_num_figures'] = 100
  51. if 'figure.max_open_warning' in matplotlib.rcParams:
  52. matplotlib.rcParams['figure.max_open_warning'] = 100
  53. if 'legend.ncol' in matplotlib.rcParams:
  54. matplotlib.rcParams['legend.ncol'] = 100
  55. if __name__ == "__main__":
  56. sys.exit(main())