1
Fork 0

Add information on animation

This commit is contained in:
Edgar P. Burkhart 2022-04-08 11:19:59 +02:00
parent c08933a472
commit 57024e768e
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -30,7 +30,7 @@ def data(var):
x = data("x")
# t = data("t")
t = data("t")
watl = data("watl")
botl = data("botl")
@ -40,6 +40,9 @@ wl = np.maximum(watl, -botl)
fig, ax = plt.subplots()
ax.plot(x, -botl, c="k")
ax.set(xlim=(x.min(), x.max()), ylim=(-30, 10), xlabel="x (m)", ylabel="z (m)")
tit = ax.text(0.5, 0, f't={t[0]}', horizontalalignment='center', verticalalignment='bottom', transform=ax.transAxes)
ax.grid()
# ax.fill_between(
# x, -botl, -data["botl"] + bathy.hstru, color="k", alpha=0.2
# )
@ -48,7 +51,9 @@ ax.plot(x, -botl, c="k")
def animate(i):
line.set_ydata(wl[i])
return (line,)
tit.set_text(f"t={t[i]*1e-3:.2f}s")
return (line, tit)
ani = animation.FuncAnimation(