24 import matplotlib.pyplot
as plt
25 import matplotlib.image
as mpimg
30 img = mpimg.imread(sys.argv[1])
32 fig, ax = plt.subplots()
34 n, bins, patches = ax.hist(img.ravel(), bins=256, fc=
"k", ec=
"k")
36 ax.set_xlabel(
"Smarts")
37 ax.set_ylabel(
"Frequency")
38 ax.set_title(sys.argv[2])
40 base = os.path.basename(sys.argv[1])
42 output_figure_name = os.path.splitext(base)[0] +
"_histogram.png"
47 fig.savefig(output_figure_name)