summaryrefslogtreecommitdiffstats
path: root/distribution.py
blob: 49d2d5e8404bddde476ebbbd24ac82cc7407c806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import matplotlib.pyplot as plt
import numpy as np
import sys


def load_distribution(filename):
    l = [int(line.strip()) for line in open(filename)]
    l = sorted(l)
    l = l[:]
    return l


def plot_distribution(files):
    for file in files:
        x = load_distribution(file)
        a = np.array(x)
        print file, a.mean(), a.size
        n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green')
        plt.show()
        # # n_nodes = float(sum(y))
        # plt.plot(x, np.array(y), ".")
        # if save:
        #     fig = plt.gcf()
        #     fig.set_size_inches(20, 15)
        #     # plt.savefig(output, bbox_inches="tight")
        # else:
        #     plt.show()

if __name__ == "__main__":
    plot_distribution(sys.argv[1:])