Skip to content

Commit fcb3700

Browse files
committed
add transpose support for plotting solutions
1 parent c6a572c commit fcb3700

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tensordiffeq/plotting.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def newfig(width, nplots = 1):
4343
return fig, ax
4444

4545

46-
def plot_solution_domain1D(model, domain, ub, lb, Exact_u = None):
46+
def plot_solution_domain1D(model, domain, ub, lb, Exact_u=None, u_transpose=False):
4747

4848
X, T = np.meshgrid(domain[0],domain[1])
4949

@@ -52,7 +52,10 @@ def plot_solution_domain1D(model, domain, ub, lb, Exact_u = None):
5252
u_star = Exact_u.T.flatten()[:,None]
5353

5454
u_pred, f_u_pred = model.predict(X_star)
55-
U_pred = griddata(X_star, u_pred.flatten(), (X, T), method='cubic')
55+
if u_transpose:
56+
U_pred = griddata(X_star, u_pred.T.flatten(), (X, T), method='cubic')
57+
else:
58+
U_pred = griddata(X_star, u_pred.flatten(), (X, T), method='cubic')
5659

5760
fig, ax = newfig(1.3, 1.0)
5861

0 commit comments

Comments
 (0)