15 lines
632 B
Python
Executable File
15 lines
632 B
Python
Executable File
#!/bin/python3
|
|
import sys
|
|
from matplotlib import pyplot as plt
|
|
|
|
data = list(map(float, sys.stdin.readline().split()))
|
|
vals, bins, _ = plt.hist(data, color='deeppink',
|
|
bins=10 if len(sys.argv) == 1 else int(sys.argv[1]),
|
|
range=(float(sys.argv[2]), float(sys.argv[3])) if len(sys.argv) == 4 else None)
|
|
for i, v in zip([a + (b-a) / 2 for a, b in zip(bins, bins[1:])], vals):
|
|
plt.text(i, v, str(int(v)), color='darkviolet', ha='center', fontweight='bold')
|
|
plt.xticks(ticks=bins,
|
|
labels=list(map(lambda e: f'{e:.5}', bins)),
|
|
rotation=30, ha='right')
|
|
plt.show()
|