#!/usr/bin/env python import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import sys if len(sys.argv) != 3: print("Wrong number of arguments.") print("USAGE: ./plot_histogram.py ") quit() input_file = sys.argv[1] output_file = sys.argv[2] f = open(input_file) X = [float(i) for i in f.readlines()] X.sort() # the histogram of the data n, bins, patches = plt.hist(X, facecolor='red') # add a 'best fit' line # y = mlab.normpdf( bins, mu, sigma) # l = plt.plot(bins, y, 'r--', linewidth=1) plt.xlabel('Power Level') plt.ylabel('Number of Samples') # plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') # plt.axis([40, 160, 0, 0.03]) # TODO: adapt for different drum kits! # plt.xlim(0,97) plt.grid(True) plt.savefig(output_file)