analistica/ex-4/plot.py

24 lines
507 B
Python
Raw Normal View History

2020-03-06 02:24:32 +01:00
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import sys
bins = input()
step = input()
bins = int(bins.split("\t")[1])
step = float(step.split("\t")[1])
counts = np.loadtxt(sys.stdin)
edges = np.linspace(0, bins*step, bins+1)
plt.rcParams['font.size'] = 17
plt.hist(edges[:-1], edges, weights=counts,
color='#eacf00', edgecolor='#3d3d3c')
plt.title('Vertical component distribution', loc='right')
plt.xlabel(r'$p_h$')
plt.ylabel(r'$\left<|p_v|\right>$')
plt.show()