-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_charts_comparison.py
50 lines (42 loc) · 1.53 KB
/
plot_charts_comparison.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from dypro.pci import functional as F
CSV_DIR = ["csv/proposed_r.csv", "csv/proposed_s.csv", "csv/proposed_v.csv"]
SAMPLE_SIZE = np.arange(2, 31)
MEAN = 1.506
SIGMA = 0.1398
USL = 2.0
LSL = 1.0
def main():
r_csv = pd.read_csv("csv/proposed_cpk_r.csv")
s_csv = pd.read_csv("csv/proposed_cpk_s.csv")
v_csv = pd.read_csv("csv/proposed_cpk_v.csv")
# r_csv = pd.read_csv("example_result/proposed_cpk_r.csv")
# s_csv = pd.read_csv("example_result/proposed_cpk_s.csv")
# v_csv = pd.read_csv("example_result/proposed_cpk_v.csv")
with plt.style.context(["science", "ieee"]):
fig, ax = plt.subplots()
plt_param = dict(xlabel="$n$", ylabel="$Dynamic$ $C_{pk}$")
ax.plot(
SAMPLE_SIZE,
F.dynamic_cpk(MEAN, SIGMA, USL, LSL, r_csv["k1 min"], r_csv["k2 min"]),
label=r"($\bar X$, $R$) $\mathrm{charts}$",
)
ax.plot(
SAMPLE_SIZE,
F.dynamic_cpk(MEAN, SIGMA, USL, LSL, s_csv["k1 min"], s_csv["k2 min"]),
label=r"($\bar X$, $S$) $\mathrm{charts}$",
)
ax.plot(
SAMPLE_SIZE,
F.dynamic_cpk(MEAN, SIGMA, USL, LSL, v_csv["k1 min"], v_csv["k2 min"]),
label=r"($\bar X$, $S^2$) $\mathrm{charts}$",
)
ax.legend(loc="lower right")
ax.autoscale(tight=True)
ax.set(**plt_param)
fig.savefig("chats_comparision.png", dpi=1000, bbox_inches="tight")
plt.close()
if __name__ == "__main__":
main()