Skip to content

Commit

Permalink
Fix time in plots (#136)
Browse files Browse the repository at this point in the history
Closes #120.

Fix annotated time shown in plot.py
  • Loading branch information
ddundo authored Mar 12, 2024
1 parent 5350fec commit 02db1e6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions goalie/plot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Driver functions for plotting solution data.
"""

from firedrake.pyplot import tricontourf, triplot # noqa
import matplotlib.pyplot as plt

Expand Down Expand Up @@ -42,8 +43,8 @@ def plot_snapshots(solutions, time_partition, field, label, **kwargs):
tc.append(tricontourf(sol, axes=ax, **kwargs))
if not steady:
time = (
i * P.end_time / cols
+ j * P.num_timesteps_per_export[i] * P.timesteps[i]
P.subintervals[i][0]
+ (j + 1) * P.timesteps[i] * P.num_timesteps_per_export[i]
)
ax.annotate(f"t={time:.2f}", (0.05, 0.05), color="white")
tcs.append(tc)
Expand Down Expand Up @@ -80,8 +81,8 @@ def plot_indicator_snapshots(indicators, time_partition, field, **kwargs):
tc.append(tricontourf(indi, axes=ax, **kwargs))
if not steady:
time = (
i * P.end_time / cols
+ j * P.num_timesteps_per_export[i] * P.timesteps[i]
P.subintervals[i][0]
+ (j + 1) * P.timesteps[i] * P.num_timesteps_per_export[i]
)
ax.annotate(f"t={time:.2f}", (0.05, 0.05), color="white")
tcs.append(tc)
Expand Down

0 comments on commit 02db1e6

Please sign in to comment.