ex-4: redo images with right size and fontsize
This commit is contained in:
parent
8d88da3c1f
commit
4561e8943f
45
ex-4/plot.py
45
ex-4/plot.py
@ -5,19 +5,38 @@ 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)
|
||||
def f(x, p_max):
|
||||
return x * np.log(p_max/x)/np.arctan(np.sqrt(p_max**2/x**2 - 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>$')
|
||||
def main():
|
||||
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.show()
|
||||
plt.figure()
|
||||
# plt.figure(figsize=(5, 3))
|
||||
# plt.rcParams['font.size'] = 8
|
||||
|
||||
plt.hist(edges[:-1], edges, weights=counts,
|
||||
histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b')
|
||||
|
||||
plt.title('Simulation', loc='right')
|
||||
plt.xlabel(r'$p_h$')
|
||||
plt.ylabel(r'$\left<|p_v|\right>$')
|
||||
|
||||
# x = np.arange(0, 10, 0.001)
|
||||
# y = f(x, 10)
|
||||
# plt.plot(x, y, c='#92182b', linewidth=2)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
# plt.savefig('notes/images/4-fit.pdf')
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user