-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
28 lines (24 loc) · 881 Bytes
/
plot.py
File metadata and controls
28 lines (24 loc) · 881 Bytes
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
#!/usr/bin/env python3
# @file: plot.py
# @auth: Sprax Lines
# @date: 2017-09-24 00:21:15 Sun 24 Sep
import matplotlib.pyplot as plt
import numpy as np
import sys
dfile = sys.argv[1] if len(sys.argv) > 1 else 'z_vals_201903130058.txt'
dskip = sys.argv[2] if len(sys.argv) > 2 else 0
darry = np.loadtxt(dfile, skiprows=dskip)
np.random.seed(444)
np.set_printoptions(precision=3)
# An "interface" to matplotlib.axes.Axes.hist() method
d = np.random.laplace(loc=15, scale=3, size=500)
n, bins, patches = plt.hist(x=darry, bins='auto', color='#0504aa', alpha=0.7, rwidth=0.85)
plt.grid(axis='y', alpha=0.75)
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.title('Histogram of Scoop Z-values from ' + dfile)
plt.text(23, 45, r'$\mu=15, b=3$')
maxfreq = n.max()
# Set a clean upper y-axis limit.
plt.ylim(ymax=np.ceil(maxfreq / 10) * 10 if maxfreq % 10 else maxfreq + 10)
plt.show()