Fix legend format
This commit is contained in:
parent
9e900b8369
commit
14a46d6057
@ -4,6 +4,7 @@ import numpy as np
|
|||||||
analytical_func = lambda x: 1 - (1 - np.exp(-10))*x - np.exp(-10*x)
|
analytical_func = lambda x: 1 - (1 - np.exp(-10))*x - np.exp(-10*x)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
fig, ax = plt.subplots()
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
x = []
|
x = []
|
||||||
y = []
|
y = []
|
||||||
@ -19,12 +20,12 @@ def main():
|
|||||||
x.append(1.)
|
x.append(1.)
|
||||||
y.append(0.)
|
y.append(0.)
|
||||||
|
|
||||||
plt.plot(x, y, label=f"n_steps={10**(i+1)}")
|
ax.plot(x, y, label=f"n$_{{steps}} = 10^{i+1}$")
|
||||||
|
|
||||||
x = np.linspace(0, 1, 1001)
|
x = np.linspace(0, 1, 1001)
|
||||||
plt.plot(x, analytical_func(x), label="analytical plot")
|
ax.plot(x, analytical_func(x), label=f"u$_{{exact}}$")
|
||||||
plt.legend()
|
ax.legend()
|
||||||
plt.savefig("../latex/images/problem7.pdf")
|
fig.savefig("../latex/images/problem7.pdf")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user