Separate into figure for each plot
This commit is contained in:
parent
14a46d6057
commit
e516104576
@ -1,9 +1,12 @@
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# plt.rc('text', usetex=True)
|
||||
# plt.rc('font', family='serif')
|
||||
|
||||
def main():
|
||||
fig_a, ax_a = plt.subplots()
|
||||
fig_b, ax_b = plt.subplots()
|
||||
# fig_c, ax_c = plt.subplots()
|
||||
fig_c, ax_c = plt.subplots()
|
||||
for i in range(6):
|
||||
x = []
|
||||
abs_err = []
|
||||
@ -16,13 +19,16 @@ def main():
|
||||
abs_err.append(float(abs_err_i))
|
||||
rel_err.append(float(rel_err_i))
|
||||
|
||||
ax_a.plot(x, abs_err, label=f"abs_err {10**(i+1)} steps")
|
||||
ax_b.plot(x, rel_err, label=f"rel_err {10**(i+1)} steps")
|
||||
ax_a.plot(x, abs_err, label=f"n$_{{steps}} = 10^{i+1}$")
|
||||
ax_b.plot(x, rel_err, label=f"n$_{{steps}} = 10^{i+1}$")
|
||||
|
||||
ax_c.plot(i+1, max(rel_err), marker="o", markersize=10)
|
||||
|
||||
ax_a.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
||||
ax_b.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
||||
fig_a.savefig("../latex/images/problem8_a.pdf", bbox_inches="tight")
|
||||
fig_b.savefig("../latex/images/problem8_b.pdf", bbox_inches="tight")
|
||||
fig_c.savefig("../latex/images/problem8_c.pdf", bbox_inches="tight")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user