13 lines
502 B
Python
Executable File
13 lines
502 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, bins=10 if len(sys.argv) == 1 else int(sys.argv[1]), color='deeppink')
|
|
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()
|