visualization – Plot an interpolation of a 2D finite element solution in python

My dataset consists of:

  • x and y coordinates of mesh points
  • a triangulation object, linking 3 points to every triangle (i.e. element in my FEA)
  • a z-value for each triangle/element

I want to plot an interpolation of the z-value.

Using matplotlib’s plot_trisurf, I manged to plot the uninterpolated z-values. I then set the view along the z-axis to make it look like a 2D image. However, interpolating using the same approach seems difficult, as the mesh-points are not arranged in a rectangular grid.

There is no absolute need to use matplotlib for the plotting (I experimented with pyvista already – without much success), but the final image should be displayable in a matplotlib subplot.

Bonus: In the subplots, I’ll need to zoom into certain parts of the domain and would like to use one colorbar for all subplots.

Read more here: Source link