make_steady.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python
  2. import sys
  3. import json
  4. import lzma
  5. import numpy as np
  6. import matplotlib
  7. import matplotlib.pyplot as pyplot
  8. import matplotlib.colors as mcolors
  9. def main():
  10. set_plot_options()
  11. buckets = [600, 1200, 1800, 2400, 3000]
  12. n = 1000000
  13. ft = []
  14. pyplot.figure()
  15. for b in buckets:
  16. delta = np.arange(1/10,1,.01)
  17. x = []
  18. for d in delta:
  19. p = n*(1.61 + (14.71/d+23.725/d**2)/b) / 86400000
  20. x.append(p)
  21. ft.append(x)
  22. pyplot.plot(delta, ft[0], label='600 Buckets')
  23. pyplot.plot(delta, ft[1], linestyle='dotted', label='1200 Buckets')
  24. pyplot.plot(delta, ft[2], linestyle='dashed', label='1800 Buckets')
  25. pyplot.plot(delta, ft[3], linestyle='dashdot', label='2400 Buckets')
  26. pyplot.plot(delta, ft[4], label='3000 Buckets')
  27. pyplot.ylim(bottom=0)
  28. pyplot.xlabel(r'$\Delta$')
  29. pyplot.ylabel("Cores / Million Users")
  30. # pyplot.title("Average Number of Bridge Users for 1 Month Old Bridges November 2021")
  31. pyplot.legend(loc="upper right")
  32. pyplot.tight_layout(pad=1)
  33. pyplot.savefig("core-users.pdf")
  34. def set_plot_options():
  35. options = {
  36. #'backend': 'PDF',
  37. 'font.size': 18,
  38. 'figure.figsize': (7,4),
  39. 'figure.dpi': 100.0,
  40. 'axes.grid' : True,
  41. 'axes.xmargin' : 0,
  42. 'axes.grid.axis' : 'y',
  43. 'axes.axisbelow': True,
  44. 'axes.titlesize' : 'medium',
  45. 'axes.labelsize' : 'large',
  46. 'axes.formatter.limits': (-6,6),
  47. 'xtick.labelsize' : 18,#get_tick_font_size_10(),
  48. 'ytick.labelsize' : 18,
  49. 'lines.linewidth' : 2.0,
  50. 'lines.markersize' : 10,
  51. # turn on the following to embedd fonts; requires latex
  52. 'ps.useafm' : True,
  53. 'pdf.use14corefonts' : True,
  54. 'text.usetex' : False,
  55. }
  56. for option_key in options:
  57. matplotlib.rcParams[option_key] = options[option_key]
  58. if 'figure.max_num_figures' in matplotlib.rcParams:
  59. matplotlib.rcParams['figure.max_num_figures'] = 100
  60. if 'figure.max_open_warning' in matplotlib.rcParams:
  61. matplotlib.rcParams['figure.max_open_warning'] = 100
  62. if 'legend.ncol' in matplotlib.rcParams:
  63. matplotlib.rcParams['legend.ncol'] = 100
  64. if __name__ == "__main__":
  65. sys.exit(main())