Generate two figures
This commit is contained in:
parent
c9f9757957
commit
f87af40008
@ -1,7 +1,9 @@
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
_, axs = plt.subplots(2)
|
fig_a, ax_a = plt.subplots()
|
||||||
|
fig_b, ax_b = plt.subplots()
|
||||||
|
# fig_c, ax_c = plt.subplots()
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
x = []
|
x = []
|
||||||
abs_err = []
|
abs_err = []
|
||||||
@ -14,12 +16,13 @@ def main():
|
|||||||
abs_err.append(float(abs_err_i))
|
abs_err.append(float(abs_err_i))
|
||||||
rel_err.append(float(rel_err_i))
|
rel_err.append(float(rel_err_i))
|
||||||
|
|
||||||
axs[0].plot(x, abs_err, label=f"abs_err {10**(i+1)} steps")
|
ax_a.plot(x, abs_err, label=f"abs_err {10**(i+1)} steps")
|
||||||
axs[1].plot(x, rel_err, label=f"rel_err {10**(i+1)} steps")
|
ax_b.plot(x, rel_err, label=f"rel_err {10**(i+1)} steps")
|
||||||
|
|
||||||
axs[0].legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
ax_a.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
||||||
axs[1].legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
ax_b.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
|
||||||
plt.savefig("../latex/images/problem8.pdf", bbox_inches="tight")
|
fig_a.savefig("../latex/images/problem8_a.pdf", bbox_inches="tight")
|
||||||
|
fig_b.savefig("../latex/images/problem8_b.pdf", bbox_inches="tight")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user