In MATLAB there is a function triplot (2-D triangular plot - MATLAB triplot) which can be used to make a triangular plot given a connectivity matrix and the corresponding (x, y) values. Is there a similar function in Julia for this purpose? and similarly e.g. for trimesh / trisurf.

I think the OP is talking about triangle mesh plots.

@legola18 take a look at Meshes.jl and MeshViz.jl if you are interested in triangulations and visualizations of these results. Voronoi-Delaunay triangulations are on the roadmap, but you have other packages out there that generate the connectivities.

Thanks @juliohm, this was the simplest for me to understand. It’s quite easy to implement with these packages actually (for triplot, anyway), e.g:

"""
triplot(T, x, y)
Generates and plots a `SimpleMesh` object for a triangulation with triangle connectivity matrix `T`
and points defined by vectors `x` and `y`. The first output is the `SimpleMesh object, and the
second plot is the scene containing the plot.
"""
function triplot(T, x, y)
# Convert into vector of tuples of points
points = Meshes.Point2[(x[i], y[i]) for i in 1:length(x)]
# Connect the points using the provided connectivity matrix T
connec = Meshes.connect.([(T[i, 1], T[i, 2], T[i, 3]) for i in 1:size(T, 1)])
# Mesh
mesh = Meshes.SimpleMesh(points, connec)
h = MeshViz.viz(mesh, showfacets = true)
return mesh, h
end
mesh, h = triplot(elements, nodes[:, 1], nodes[:, 2])