It looks like when the points are not given in a â€śsquare mannerâ€ť, the 2d contour plot looks strange.
When 6 points (0,0) (1,0) (2,0) (0,1) (1,1) (2,1) are given, the plot looks perfect.

Is it using linear interpolation to generate the contour plot?
Where does Plotly handle the plot contour algorithm?
I would appreciate any help you offer.
Thank you.

In your example x, y and z are intended to be simple lists, but they arenâ€™t because nodes is a list of lists, NOT a numpy array, and you cannot slice it in this way because it leads to the following error:

----> 1 nodes[:,0]
TypeError: list indices must be integers, not tuple

Hi empet. Thank you for your detailed reply and references. However, the problem still exists after I converted the data type.
Basically, Iâ€™m trying to do the visualization of FEM analysis but the plot looks strange when the mesh is not grid-based. (e.g. triangular mesh or some random quadrangle mesh) In the txt file I have nodeID, X, Y, and value of the nodes.

The first image is what I get when the mesh type is not a perfect rectangle.
The second image is what I get when the mesh type is perfect rectangle, which matches the result of a commercial product.

Plotly works with rectangular meshes. The contour points are computed via marching squares algorithm, and they are interpolated by the centripetal Catmull-Rom method.