check_blockages_server.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import sys
  2. import pandas as pd
  3. import matplotlib
  4. import matplotlib.pyplot as plt
  5. from matplotlib.lines import Line2D
  6. def main():
  7. set_plot_options()
  8. fig, axs = plt.subplots(1, 2, figsize=(24, 7))
  9. columns = ["Percent", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  10. "ReTstdev"]
  11. df = pd.read_csv("check_blockage.csv", usecols=columns)
  12. fig.supxlabel('Blocked Bridges (%)')
  13. axs[0].set_ylabel('Response Time (ms)')
  14. axs[0].plot(df.Percent, df.ResponseT, color='#CC4F1B',
  15. label='Response Time for Percentage of Bridges Blocked')
  16. axs[0].fill_between(df.Percent, df.ResponseT-df.ReTstdev,
  17. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B',
  18. facecolor='#FF9848')
  19. axs[1].set_ylabel('Response Size (ms)')
  20. axs[1].plot(df.Percent, df.ResponseS, color='#CC4F1B',
  21. label='Response Size for Percentage of Bridges Blocked')
  22. fig.savefig("Performance2.pdf")
  23. def set_plot_options():
  24. options = {
  25. 'font.size': 12,
  26. 'figure.figsize': (4,2),
  27. 'figure.dpi': 100.0,
  28. 'figure.subplot.left': 0.20,
  29. 'figure.subplot.right': 0.97,
  30. 'figure.subplot.bottom': 0.20,
  31. 'figure.subplot.top': 0.90,
  32. 'grid.color': '0.1',
  33. 'grid.linestyle': ':',
  34. #'grid.linewidth': 0.5,
  35. 'axes.grid' : True,
  36. #'axes.grid.axis' : 'y',
  37. #'axes.axisbelow': True,
  38. 'axes.titlesize' : 'x-large',
  39. 'axes.labelsize' : 'x-large',
  40. 'axes.formatter.limits': (-4,4),
  41. 'xtick.labelsize' : 20,#get_tick_font_size_10(),
  42. 'ytick.labelsize' : 20,#get_tick_font_size_10(),
  43. 'lines.linewidth' : 2.0,
  44. 'lines.markeredgewidth' : 0.5,
  45. 'lines.markersize' : 10,
  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())