# Plotting on an unstructured grid

**URL:** https://discourse.julialang.org/t/plotting-on-an-unstructured-grid/89316
**Category:** General Usage
**Tags:** plotting, plots
**Created:** [October 26, 2022, 6:20pm UTC](https://discourse.julialang.org/t/plotting-on-an-unstructured-grid/89316 "2022-10-26T18:20:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![HMegh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hmegh/32/216684_2.png) [@HMegh](https://discourse.julialang.org/u/HMegh)
#### Post date: [October 26, 2022, 6:20pm UTC](https://discourse.julialang.org/t/plotting-on-an-unstructured-grid/89316/1 "2022-10-26T18:20:46Z")

</div>

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

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

```

I get the following error

```julia
*** 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:

```julia
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

```julia
 *** 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

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

```

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

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [October 26, 2022, 10:44pm UTC](https://discourse.julialang.org/t/plotting-on-an-unstructured-grid/89316/3 "2022-10-26T22:44:42Z")

</div>

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.

Please provide a more complete/adequate input data sample.

---

<div class="post-metadata">

### Author: ![HMegh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hmegh/32/216684_2.png) [@HMegh](https://discourse.julialang.org/u/HMegh)
#### Post date: [October 27, 2022, 6:53pm UTC](https://discourse.julialang.org/t/plotting-on-an-unstructured-grid/89316/4 "2022-10-27T18:53:38Z")

</div>

Thanks for letting me know. I was able to fix the issue by using a different set of points.
