pets_plots.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. plt.figure(figsize=(9, 5))
  8. columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  9. "ReTstdev", "ResponseHT", "RHTstdev"]
  10. df = pd.read_csv("standard_check"+".csv", usecols=columns)
  11. df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True)
  12. bridges = df.Bridges*2*3
  13. plt.xlabel('Blocked Bridges (%)', size=20)
  14. plt.ylabel('Response Time (ms)', size=20)
  15. plt.tick_params(axis='x', labelsize=15)
  16. plt.tick_params(axis='y', labelsize=15)
  17. plt.plot(df.Percent, df.ResponseT, color='#CC4F1B',
  18. label='Response Time for Percentage of Bridges Blocked')
  19. plt.fill_between(df.Percent, df.ResponseT-df.ReTstdev,
  20. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B',
  21. facecolor='#FF9848')
  22. plt.tight_layout(pad=1)
  23. plt.savefig("Blockage-response-time.pdf")
  24. plt.close('all')
  25. def set_plot_options():
  26. options = {
  27. 'font.size': 12,
  28. 'figure.figsize': (10,2),
  29. 'figure.dpi': 100.0,
  30. 'figure.subplot.left': 0.20,
  31. 'figure.subplot.right': 0.97,
  32. 'figure.subplot.bottom': 0.20,
  33. 'figure.subplot.top': 0.90,
  34. 'grid.color': '0.1',
  35. 'grid.linestyle': ':',
  36. #'grid.linewidth': 0.5,
  37. 'axes.grid' : True,
  38. #'axes.grid.axis' : 'y',
  39. #'axes.axisbelow': True,
  40. 'axes.titlesize' : 25,
  41. 'axes.labelsize' : 25,
  42. 'axes.formatter.limits': (-4,4),
  43. 'xtick.labelsize' : 30,#get_tick_font_size_10(),
  44. 'ytick.labelsize' : 30,#get_tick_font_size_10(),
  45. 'lines.linewidth' : 2.0,
  46. 'lines.markeredgewidth' : 0.5,
  47. 'lines.markersize' : 15,
  48. }
  49. for option_key in options:
  50. matplotlib.rcParams[option_key] = options[option_key]
  51. if 'figure.max_num_figures' in matplotlib.rcParams:
  52. matplotlib.rcParams['figure.max_num_figures'] = 100
  53. if 'figure.max_open_warning' in matplotlib.rcParams:
  54. matplotlib.rcParams['figure.max_open_warning'] = 100
  55. if __name__ == "__main__":
  56. sys.exit(main())