Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- import sys
- from time_stats import get_times_map, seconds_to_time
- MIN_TIME = 60
- MAX_TIME = 160
- STEP_SIZE = 4
- def plot(times):
- bins = range(MIN_TIME, MAX_TIME + STEP_SIZE, STEP_SIZE)
- labels = [seconds_to_time(bin_seconds) for bin_seconds in bins]
- ax = plt.subplot(111)
- plt.hist(times, bins=bins, label=labels)
- ax.set_xticks(bins)
- ax.set_xticklabels(labels, rotation=45)
- plt.ylabel('Kills (total: %s)' % (len(times)))
- plt.xlabel('Time (average %s, median %s, stddev %s, min %s, max %s)' % (
- seconds_to_time(np.mean(times)),
- seconds_to_time(np.median(times)),
- seconds_to_time(np.std(times)),
- seconds_to_time(min(times)),
- seconds_to_time(max(times)),
- ))
- hist = plt.gcf()
- plt.show()
- hist.savefig('histogram_zulrah.png', bbox_inches='tight')
- def plot_times(filename):
- times_map = get_times_map(filename)
- time_list = times_map[times_map.keys()[0]]
- plot(time_list)
- if __name__=='__main__':
- if len(sys.argv) != 2:
- print 'Usage: plot_times.py [input file]'
- else:
- plot_times(sys.argv[1])
Advertisement
Add Comment
Please, Sign In to add comment