<p>You might find the answer at <a href="https://stackoverflow.com/questions/77265426/python-plotly-planes-perpendicular-to-axes-in-3d-plot">https://stackoverflow.com/questions/77265426/python-plotly-planes-perpendicular-to-axes-in-3d-plot</a> very helpful. Essentially your x,y, and z lists form a number of vectors (so the total number of vectors is size(x)=size(y)=size(z)=(8 in your example), and the i,j,k each specify a particular vector. So each triangle is formed from 3 vectors. The total number of triangles is size(I)=size(j)=size(k)= (12 in your example). The lth triangle is formed from combining the i[l] vector, the j[l] vector, and the k[l] vector. In the example you provided, the first triangle would be formed from  vectors [1,0,1],[1,0,0],[0,0,0], since these are the 7th,3rd, and 0th vectors respectively.</p>

CC BY-SA 4.0
2024-09-09T00:39:19.583Z
2024-09-09T00:39:19.583Z
user27257916
<p>Most mesh drawing tools use triangles to draw meshes, for technical reasons.</p>

<p>You <em>could</em> simply specify the coordinates of the three vertices of each triangle, but that is a bit wasteful in terms of memory.</p>

<p>What is done in many places is to specify a list of points in space, with their coordinates, and then specify a list of triangles, using indices of the points in the first list. </p>

<p>The exact same thing happens here. The x,y,z parameters form a list of points. The I,j,k parameters indicate triangles, using IDs in the list of points. </p>

<p>Have a look at the function documentation for more details:
<a href="https://plot.ly/python/reference/#mesh3d" rel="noreferrer">https://plot.ly/python/reference/#mesh3d</a></p>

CC BY-SA 4.0
2019-07-01T09:49:32.857Z
It took me a good 2 hours to understand this simple idea. Reading back and forth from your answer to your referenced documentation I finally understood what you meant by "..indices of the points in the first list". I was thinking in the context of math here, and what indices could possibly mean in that context. But it's actually just indices in the programming context, i.e. indices of an array f.e.
In my case that means f.e. that the first i-value (7) just means "this vertex points to the x-y-z-point with index 7 (which is the last one since I only have 8 points) in the x-y-z-list".
thz
CC BY-SA 4.0
2019-06-30T23:37:06.323Z
2019-06-30T23:37:06.323Z
Paul92
<p>A 3d Mesh on plot.ly online graph maker (<a href="https://plot.ly/create/#/" rel="nofollow noreferrer">https://plot.ly/create/#/</a>) takes 3 mandatory variables (X, Y, Z) and 3 optional variables (I, J, K).
I understand that if I want to draw a cube that I then have to use the IJK-variables, since without them nothing will be drawn.</p>

<p>After some googling I found that with i, j, k you can represent vectors. Though I do not understand how in the following examples they correspond to the XYZ values, so that a cube can be drawn.
There are several examples of cubes and cuboids on plot.ly, all of which share the same i, j, k, values. 
f.e.
<a href="https://plot.ly/create/?fid=RPlotBot%3A3933#/" rel="nofollow noreferrer">https://plot.ly/create/?fid=RPlotBot%3A3933#/</a></p>

<p><a href="https://plot.ly/create/?fid=markope%3A143#/" rel="nofollow noreferrer">https://plot.ly/create/?fid=markope%3A143#/</a></p>

<p>Taking the first link as an example:</p>

<pre><code>x   y   z       i   j   k
0   0   0       7   3   0
0   1   0       0   4   7
1   1   0       0   1   2
1   0   0       0   2   3
0   0   1       4   5   6
0   1   1       4   6   7
1   1   1       6   5   1
1   0   1       6   2   1
                4   0   5
                0   1   5
                3   6   7
                2   3   6
</code></pre>

<p>This will draw a normal cube.
When I try my XYZ-coordinates, however, it will draw following:
<a href="https://i.sstatic.net/S4lkf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/S4lkf.png" alt="enter image description here"></a></p>

<p>My xyz-coordinates are:</p>

<pre><code>x   y   z
25  25  65
25  55  65
55  25  65
55  55  65
25  25  80
25  55  80
55  25  80
55  55  80
</code></pre>

<p>How can I calculate the according ijk-values so that I get a cuboid? Any tips or links to resources?</p>

<p>The <a href="https://help.plot.ly/make-a-3d-mesh-plot" rel="nofollow noreferrer">official tutorial</a> for a 3d mesh on plot.ly online graph maker only mentions the ijk-values, doesn't explain them though.</p>

<3d><vector-graphics>
What are the i,j,k components of a 3d mesh on plot.ly (online)?
thz
# What are the i,j,k components of a 3d mesh on plot.ly (online)?

(Asked by: username_0 on 2019-06-30)

A 3d Mesh on plot.ly online graph maker (<https://plot.ly/create/#/>) takes 3 mandatory variables (X, Y, Z) and 3 optional variables (I, J, K).
I understand that if I want to draw a cube that I then have to use the IJK-variables, since without them nothing will be drawn.

After some googling I found that with i, j, k you can represent vectors. Though I do not understand how in the following examples they correspond to the XYZ values, so that a cube can be drawn.
There are several examples of cubes and cuboids on plot.ly, all of which share the same i, j, k, values.
f.e.
<https://plot.ly/create/?fid=RPlotBot%3A3933#/>

<https://plot.ly/create/?fid=markope%3A143#/>

Taking the first link as an example:

```
x   y   z       i   j   k
0   0   0       7   3   0
0   1   0       0   4   7
1   1   0       0   1   2
1   0   0       0   2   3
0   0   1       4   5   6
0   1   1       4   6   7
1   1   1       6   5   1
1   0   1       6   2   1
                4   0   5
                0   1   5
                3   6   7
                2   3   6

```

This will draw a normal cube.
When I try my XYZ-coordinates, however, it will draw following:
[![enter image description here](https://i.sstatic.net/S4lkf.png)](https://i.sstatic.net/S4lkf.png)

My xyz-coordinates are:

```
x   y   z
25  25  65
25  55  65
55  25  65
55  55  65
25  25  80
25  55  80
55  25  80
55  55  80

```

How can I calculate the according ijk-values so that I get a cuboid? Any tips or links to resources?

The [official tutorial](https://help.plot.ly/make-a-3d-mesh-plot) for a 3d mesh on plot.ly online graph maker only mentions the ijk-values, doesn't explain them though.

**Tags:** 3d, vector-graphics


---

## 2 answers

### Answer by username_2 on 2019-06-30. Score: 5 | Accepted answer

Most mesh drawing tools use triangles to draw meshes, for technical reasons.

You *could* simply specify the coordinates of the three vertices of each triangle, but that is a bit wasteful in terms of memory.

What is done in many places is to specify a list of points in space, with their coordinates, and then specify a list of triangles, using indices of the points in the first list.

The exact same thing happens here. The x,y,z parameters form a list of points. The I,j,k parameters indicate triangles, using IDs in the list of points.

Have a look at the function documentation for more details:
<https://plot.ly/python/reference/#mesh3d>

> **Comments:**
> **username_0**: It took me a good 2 hours to understand this simple idea. Reading back and forth from your answer to your referenced documentation I finally understood what you meant by "..indices of the points in the first list". I was thinking in the context of math here, and what indices could possibly mean in that context. But it's actually just indices in the programming context, i.e. indices of an array f.e. In my case that means f.e. that the first i-value (7) just means "this vertex points to the x-y-z-point with index 7 (which is the last one since I only have 8 points) in the x-y-z-list".  

---

### Answer by username_1 on 2024-09-09. Score: 0

You might find the answer at <https://stackoverflow.com/questions/77265426/python-plotly-planes-perpendicular-to-axes-in-3d-plot> very helpful. Essentially your x,y, and z lists form a number of vectors (so the total number of vectors is size(x)=size(y)=size(z)=(8 in your example), and the i,j,k each specify a particular vector. So each triangle is formed from 3 vectors. The total number of triangles is size(I)=size(j)=size(k)= (12 in your example). The lth triangle is formed from combining the i[l] vector, the j[l] vector, and the k[l] vector. In the example you provided, the first triangle would be formed from vectors [1,0,1],[1,0,0],[0,0,0], since these are the 7th,3rd, and 0th vectors respectively.


---

