#!/usr/bin/env python import sys import json import lzma import datetime import numpy as np import matplotlib import matplotlib.pyplot as pyplot import matplotlib.colors as mcolors def main(): set_plot_options() days=np.arange(180) ft = [] # initialize users to 20 users = 20 total_users = users g = 0 h = 0 i = 0 g_two = 0 h_two = 0 i_two = 0 g_two_two = 0 h_two_two = 0 i_two_two = 0 g_two_four = 0 h_two_four = 0 i_two_four = 0 g_four = 0 g_four_two = 0 h_four = 0 i_four = 0 g_six = 0 h_six = 0 i_six = 0 g_users = 0 h_users = 0 i_users = 0 g_two_users = 0 h_two_users = 0 pyplot.figure() for f in days: if g > 1: g = g+1 if h > 1: h = h+1 if g_two > 1: g_two = g_two+1 if h_two > 1: h_two = h_two+1 if g_two_two > 1: g_two_two = g_two_two+1 if h_two_two > 1: h_two_two = h_two_two+1 if g_two_four > 1: g_two_four = g_two_four+1 if h_two_four > 1: h_two_four = h_two_four+1 if g_four > 1: g_four = g_four+1 if g_four_two > 1: g_four_two = g_four_two+1 if f == 72: g = 44 g_users = users*2 total_users = total_users+g_users if f == 128: h= 44 h_users = users*4 total_users = total_users+h_users if g == 72: g_two_users = g_users * 2 total_users = total_users+g_two_users g_two = 44 if g_two == 72: g_two_two = 44 g_two_two_users = g_two_users*2 total_users = total_users+g_two_two_users if g_two_two == 72: g_six_users = g_two_two_users*2 total_users = total_users+g_six_users if h == 72: h_two_users = h_users * 2 total_users = total_users+h_two_users h_two =44 if g == 128: g_four = 44 g_four_users = g_users* 4 total_users = total_users+g_four_users if h_two == 72: h_two_two = 44 h_two_two_users = h_two_users*2 total_users = total_users+h_two_two_users if g_four == 72: g_four_two = 44 g_four_two_users = g_four_users*2 total_users = total_users+g_four_two_users x = total_users ft.append(x) pyplot.plot(days, ft, label='Invited Users') pyplot.ylabel("Users") pyplot.xlabel("Number of Days") # pyplot.title("Average Number of Bridge Users for 1 Month Old Bridges November 2021") # pyplot.legend(title="Protocols", loc="upper left") pyplot.tight_layout(pad=1) pyplot.savefig("invited-users.pdf") def set_plot_options(): options = { #'backend': 'PDF', 'font.size': 12, 'figure.figsize': (7,5), 'figure.dpi': 100.0, 'axes.grid' : True, 'axes.xmargin' : 0.01, 'axes.grid.axis' : 'y', 'axes.axisbelow': True, 'axes.titlesize' : 'medium', 'axes.labelsize' : 'large', 'axes.formatter.limits': (-6,6), 'xtick.labelsize' : 10,#get_tick_font_size_10(), 'ytick.labelsize' : 10, 'lines.linewidth' : 2.0, 'lines.markersize' : 10, # turn on the following to embedd fonts; requires latex 'ps.useafm' : True, 'pdf.use14corefonts' : True, 'text.usetex' : False, } for option_key in options: matplotlib.rcParams[option_key] = options[option_key] if 'figure.max_num_figures' in matplotlib.rcParams: matplotlib.rcParams['figure.max_num_figures'] = 100 if 'figure.max_open_warning' in matplotlib.rcParams: matplotlib.rcParams['figure.max_open_warning'] = 100 if 'legend.ncol' in matplotlib.rcParams: matplotlib.rcParams['legend.ncol'] = 100 if __name__ == "__main__": sys.exit(main())