I have data as follow: x, y, triangles
On MATLAB and using the trisurf function, I provide (triangles, x, y) to get the result, very straight forward.
On Matplotlib however, I get:
- Triangles number out of bound (if I use existing triangles)
- Strange line outside my geometry if I let tri.triangulation de decide on the triangles.
maybe my problem requires different approach, I would be pleased if someone can direct me to a better solution.
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import pandas as pd
import numpy as np
dlel = pd.read_fwf(‘HSH_Calculation.LEL’)
dlnd = pd.read_fwf(‘HSH_Calculation.LND’)
dt = pd.read_fwf(‘HSH_Calculation.HTD’)
xy = np.asarray(dlnd.iloc[:, 3:5])
x = xy[:, 0]
y = xy[:, 1]
triangles = np.asarray(dlel.iloc[:, 1:4])
triang = tri.triangulation(x,y)
triang = tri.Triangulation(x, y)
plt.triplot(x, y, triangles, ‘go-’, lw=1.0)
plt.triplot(triang, ‘go-’, lw=1.0)