# Plotting a plane with mesh3d

I would like to plot a plane by specifying its four corners. I can successfully show a plane with its normal pointing in the z-direction like this:

``````data = [{
'type': 'mesh3d',
'x': [0,1,1,0],
'y': [0,0,1,1],
'z': [0,0,0,0],
'color': 'green',
'opacity': 0.5,
}]

fig = go.Figure(data=data, layout={})
iplot(fig)
``````

However, if I swap the βxβ and βzβ coordinates, which should result in a plane whose normal points in the y-direction, my plane no longer shows:

``````data = [{
'type': 'mesh3d',
'x': [0,0,0,0],
'y': [0,0,1,1],
'z': [0,1,1,0],
'color': 'green',
'opacity': 0.5,
}]
``````

Any ideas? Thanks.

@MrWallace Your plane is generated as a Delaunay triangulation of the four points, and its triangles are filled with the green color.
When the points that define the Delaunay triangulation are coplanar, you should set the `delaunayaxis`
key. Its default value is βzβ (thatβs why your first example works). In the second case the right data description is:

``````data = [{
'type': 'mesh3d',
'x': [0,0,0,0],
'y': [0,0,1,1],
'z': [0,1,1,0],
'delaunayaxis':'x',
'color': 'green',
'opacity': 0.5,
}]
``````

The `delaunayaxis` sets the working direction for the Delaunay triangulation algorithm.

When delaunayaxis=βzβ, the algorithm starts constructing the triangulation from a point with the highest z-coordinate,
and chooses vertically the nearby points, to define the Delaunay triangles. When delaunayaxis=βxβ or βyβ the algorithm works in the x-axis, respectively y-axis direction.

1 Like

Brilliant, thank you!