How to create a 3D plot for a time-dependent PDE in a 2D domain using FEniCS? Please provide some link or syntax
from dolfin import *
import numpy as np
import math
from mpl_toolkits.mplt3d import Axes3D
import matplotlib.pyplot as plt
#Plot the solution in 3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = mesh.coordinates()[:,0]
y = mesh.coordinates()[:,1]
u = u_n.compute_vertex_values(mesh)
ax.plot_trisurf(x, y, u, cmap='viridis')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('u')
plt.show()
I used this syntax for 3D plotting but it does not work.
(Run time error)
from mpl_toolkits.mplt3d import Axes3D
ModuleNotFoundError: No module named 'mpl_toolkits.mplt3d'
Thank you for your response. I have successfully plotted the approximate solution u_h in Fenics, but I am having trouble plotting the exact solution. The exact solution is given by u(x,y,t)=t^2\sin(\pi x)\sin(\pi y). Could you please provide me with the syntax or any reference that could help me plot the solution?