/
4.py
20 lines (20 loc) · 800 Bytes
/
4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#CLOSE
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import rc
import matplotlib.pyplot as plt
x = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9])
y1 = np.array([0.657560976, 0.723902439, 0.376260163, 0.434796748, 0.328455285, 0.127479675, 0.058211382, 0.063089431, 0.087479675])
y2 = np.log10(1+1/x)
plt.clf() # Ensures a clean plotting canvas.
plt.rc('text', usetex=True)
plt.rc('figure', figsize=(1920, 1080))
plt.rc('font', family='serif', serif=['Computer Modern Roman'], size=14)
plt.ylabel("$P(\delta)$")
plt.xlabel("$\delta$")
plt.plot(x, y1, "k--", label='$Actual\ Probability$')
plt.plot(x, y2, "k-", label='$Theoretical\ Probability$')
plt.legend(loc='upper right', frameon=False, handlelength=3)
plt.savefig('4.pdf', format="pdf")
plt.savefig('4.png', format="png")