# Plotting on an unstructured grid

I have points \{(x_i,y_i)\}_{i=1}^n and values \{z_i\}_{i=1}^n and I wish to plot them as a surface plot. However, when using

``````surface(x,y,z)
``````

I get the following error

``````***   IDENTICAL DATA POINTS.
NDP = 3772   IP1 =  454   IP2 =  455   XD=-0.66677   YD=-0.799619
ERROR DETECTED IN ROUTINE   IDTANG.
``````

Although I am pretty sure that there are no duplicate points.

To create a minimal working example, I extracted the points where the error happened:

``````A=[ -0.66677   -0.799619  0.0830287
-0.667204  -0.799619  0.0829778
-0.667952  -0.799619  0.0828899
-0.668957  -0.799619  0.0827716
-0.670145  -0.799619  0.0826315];
x=A[:,1];
y=A[:,2];
z=A[:,3]

surface(x,y,z)
``````

This returns

`````` ***   IDENTICAL DATA POINTS.
NDP =    5   IP1 =    1   IP2 =    2   XD=-0.66677   YD=-0.799619
ERROR DETECTED IN ROUTINE   IDTANG.
``````

The first two points are close to each other, but they are not identical. Does anyone have any idea on how to resolve this issue or another way to obtain the surface plot?

Side note: Coming from a MATLAB background, I am trying to get a result similar to what

``````tri=delaunay(x,y);
trisurf(tri,x,y,z)
``````

offers. I am not sure to replicate that or obtain something similar.

For the example provided, the data is actually a line in 3D space (the y-coordinate is constant) and Plots.jl will complain that there is no surface to plot.