Generate histogram from qzpercentages.csv.
# We want to inline graphics into our notebook so we need this line:
%pylab inline
# Lets take a look at the file so that we know what we are dealing with.
%load ../data/qzpercentages.csv
Populating the interactive namespace from numpy and matplotlib
Quartz Percentages in Samples
53
49
56
61
41
52
24
51
32
34
51
49
41
45
48
57
47
42
36
55
47
50
58
53
45
37
45
41
51
46
42
61
47
40
55
37
35
43
32
43
53
29
56
56
46
36
40
37
50
39
45
43
38
37
53
51
55
51
48
50
55
55
48
46
50
53
51
42
52
54
48
52
60
43
46
42
40
34
44
43
46
48
61
54
46
44
57
56
41
54
60
55
32
38
45
63
44
51
65
45
34
47
42
49
51
41
55
56
48
44
28
50
66
50
42
36
47
51
42
56
33
44
35
44
43
49
38
48
49
34
46
53
41
51
46
45
36
54
45
65
48
45
50
48
52
34
41
44
48
40
40
52
52
45
55
38
48
42
46
46
42
# As before, lets make this short and sweet.
import numpy as np
record = np.recfromcsv("../data/qzpercentages.csv")
array = np.array(record, dtype=float)
# A quick online search quickly throws up a series of histogram examples.
# e.g. http://matplotlib.org/1.3.0/examples/pylab_examples/histogram_demo_extended.html
import pylab
n, bins, patches = pylab.hist(array, bins=10, range=(20, 70), color="green")
pylab.setp(patches, linewidth=3)
pylab.title("Histogram of quartz percentages in %d samples"%array.shape[0])
pylab.xlabel("Quartz percentage")
pylab.ylabel("Frequency")
pylab.xticks(range(20, 71, 5))
pylab.show()