ex-7: added the font size at plot.py

This commit is contained in:
Giù Marcer 2020-04-03 23:27:58 +02:00 committed by rnhmjoj
parent 29098a19d2
commit ef5f8d5a33

View File

@ -7,6 +7,8 @@ def line(x, y, **args):
'''line between two points x,y''' '''line between two points x,y'''
plot([x[0], y[0]], [x[1], y[1]], **args) plot([x[0], y[0]], [x[1], y[1]], **args)
plt.rcParams['font.size'] = 30
w = loadtxt(sys.stdin, max_rows=2) w = loadtxt(sys.stdin, max_rows=2)
v = array([[0, -1], [1, 0]]) @ w v = array([[0, -1], [1, 0]]) @ w
cut = float(input()) cut = float(input())
@ -17,18 +19,17 @@ signal, noise = data[:n].T, data[n:].T
figure() figure()
subplot(aspect='equal') subplot(aspect='equal')
scatter(*signal, c='xkcd:grey blue', label='signal') scatter(*signal, edgecolor='#51492d', c='#dbbb4a', label='signal')
scatter(*noise, c='xkcd:baby blue', label='noise') scatter(*noise, edgecolor='#512d3d', c='#d64d88', label='noise')
line(-20*w, 20*w, c='xkcd:blue', label='projection') line(-20*w, 20*w, c='xkcd:blue', label='projection')
line(w-10*v, w+10*v, c='xkcd:red', label='cut') line(w-10*v, w+10*v, c='xkcd:red', label='cut')
xlim(-1.5, 8) xlim(-1.5, 8)
ylim(-1.5, 8) ylim(-1.5, 8)
legend()
figure() figure()
sig_proj = np.dot(w, signal) sig_proj = np.dot(w, signal)
noise_proj = np.dot(w, noise) noise_proj = np.dot(w, noise)
hist(sig_proj, color='xkcd:grey blue') hist(sig_proj, color='#dbbb4a')
hist(noise_proj, color='xkcd:baby blue') hist(noise_proj, color='#d64d88')
axvline(cut, c='r') axvline(cut, c='r')
show() show()