trust_promo_plot.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. fig, axs = plt.subplots(1, 3, figsize=(24, 7))
  8. columns = ["Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT",
  9. "ReTstdev", "ResponseHT", "RHTstdev"]
  10. df = pd.read_csv("trust_promo"+".csv", usecols=columns)
  11. bridges = df.Bridges*2*3
  12. fig.supxlabel('Total Size of Bridge Pool',size=30)
  13. axs[0].set_ylabel('Response Time (ms)', size=25)
  14. axs[0].tick_params(axis='x', labelsize=15)
  15. axs[0].tick_params(axis='y', labelsize=15)
  16. axs[0].plot(bridges, df.ResponseT, color='#29135F',
  17. label='Response Time for Trust Promotion')
  18. axs[0].fill_between(bridges, df.ResponseT-df.ReTstdev,
  19. df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#29135F',
  20. facecolor='#8967E2')
  21. axs[1].set_ylabel('Response Size (bytes)', size=25)
  22. axs[1].tick_params(axis='x', labelsize=15)
  23. axs[1].tick_params(axis='y', labelsize=15)
  24. axs[1].plot(bridges, df.ResponseS, color='#29135F',
  25. label='Response Size for Trust Promotion')
  26. axs[2].set_ylabel('Response Handling Time (ms)', size=25)
  27. axs[2].tick_params(axis='x', labelsize=15)
  28. axs[2].tick_params(axis='y', labelsize=15)
  29. axs[2].plot(bridges, df.ResponseHT, color='#29135F',
  30. label='Response Handling Time for Trust Promotion')
  31. axs[2].fill_between(bridges, df.ResponseHT-df.RHTstdev,
  32. df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#29135F',
  33. facecolor='#8967E2')
  34. fig. tight_layout(pad=1)
  35. fig.savefig("TrustPromotion.pdf")
  36. print("\nDone Trust Promotion Plot.\nOutput to: TrustPromotion.pdf")
  37. def set_plot_options():
  38. options = {
  39. 'font.size': 12,
  40. 'figure.figsize': (4,2),
  41. 'figure.dpi': 100.0,
  42. 'figure.subplot.left': 0.20,
  43. 'figure.subplot.right': 0.97,
  44. 'figure.subplot.bottom': 0.20,
  45. 'figure.subplot.top': 0.90,
  46. 'grid.color': '0.1',
  47. 'grid.linestyle': ':',
  48. #'grid.linewidth': 0.5,
  49. 'axes.grid' : True,
  50. #'axes.grid.axis' : 'y',
  51. #'axes.axisbelow': True,
  52. 'axes.titlesize' : 'large',
  53. 'axes.labelsize' : 'x-large',
  54. 'axes.formatter.limits': (-4,4),
  55. 'xtick.labelsize' : 20,#get_tick_font_size_10(),
  56. 'ytick.labelsize' : 20,#get_tick_font_size_10(),
  57. 'lines.linewidth' : 2.0,
  58. 'lines.markeredgewidth' : 0.5,
  59. 'lines.markersize' : 10,
  60. }
  61. for option_key in options:
  62. matplotlib.rcParams[option_key] = options[option_key]
  63. if 'figure.max_num_figures' in matplotlib.rcParams:
  64. matplotlib.rcParams['figure.max_num_figures'] = 100
  65. if 'figure.max_open_warning' in matplotlib.rcParams:
  66. matplotlib.rcParams['figure.max_open_warning'] = 100
  67. if __name__ == "__main__":
  68. sys.exit(main())