analistica/ex-4/plot.py

24 lines
530 B
Python
Executable File

#!/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,
histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b')
plt.title('Vertical component distribution', loc='right')
plt.xlabel(r'$p_h$')
plt.ylabel(r'$\left<|p_v|\right>$')
plt.show()