ex-6: redo 6-smoothed.pdf with the right font in the title
The code in plot.py is also made more easy to use for passing from one mode to the other (show or save figure).
This commit is contained in:
parent
defd851618
commit
4e242b3463
26
ex-6/plot.py
26
ex-6/plot.py
@ -1,18 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from pylab import *
|
||||
from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
import sys
|
||||
|
||||
figure()
|
||||
a, b, f = np.loadtxt(sys.stdin, unpack=True)
|
||||
|
||||
a, b, f = loadtxt(sys.stdin, unpack=True)
|
||||
title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right')
|
||||
hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f),
|
||||
plt.figure()
|
||||
# plt.figure(figsize=(5, 3))
|
||||
# plt.rcParams['font.size'] = 8
|
||||
|
||||
plt.title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right')
|
||||
plt.xlabel(r'$\theta$ (radians)')
|
||||
plt.ylabel(r'$I(\theta)$ (a.u.)')
|
||||
plt.hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f),
|
||||
histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b')
|
||||
xlabel(r'$\theta$ (radians)')
|
||||
ylabel(r'$I(\theta)$ (a.u.)')
|
||||
|
||||
xlabel('$\\theta$')
|
||||
ylabel('$I(\\theta)$')
|
||||
tight_layout()
|
||||
show()
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
# name = sys.argv[2] if len(sys.argv) > 1 else "prova"
|
||||
# plt.savefig('notes/images/' + name + '.pdf')
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user