So matplotlib is really neat and powerful yet elegant and easy to use. Here we have this simple hist with all you need:
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
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('TkAgg')
import numpy as np
import pylab
# read file
with open('.../nums.txt', 'r') as f:
data = f.readlines()
nums = []
for line in data:
nums.append(int(line))
#find central tendency measures
mu = np.mean(nums)
median = np.median(nums)
sigma = np.std(nums)
#plot
fig, ax = plt.subplots(1)
ax.hist(nums, bins = 30, color = 'c')
ax.axvline(np.mean(nums), color='b', linestyle='dashed', linewidth=2)
props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$'%(mu, median, sigma)
ax.text(0.65, 0.95, textstr, transform=ax.transAxes, fontsize=14,
verticalalignment='top', bbox=props)
pylab.show()
Which produces this:

PS nums.txt it’s just a file with numbers.