I have 4 corners of a rectangle (like this).
all_corners[0] = [[16.9491164719, 17.8960237441, 0.0],
[17.89665059755603, 27.22995253575736, 0.0],
[16.9491164719, 17.8960237441, 2.552],
[17.89665059755603, 27.22995253575736, 2.552]]
I need to plot this rectangle in a 3d space and I also need to plot multiple rectangles in a similar way. Is there any way to get this done? Also I need this to work for arbitrary shapes like quadrilateral, polygon but it's secondary for now, first I need to plot a shaded rectangle with given corner coordinates.
I tried Poly3dCollection, i'm getting weird traingles, not rectangles and many methods I found isn't what I want or I'm getting errors.
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib.pyplot as plt
fig = plt.figure()
ax = Axes3D(fig)
ax.add_collection3d(Poly3DCollection(all_corners[0]))
ax.set_ylim3d(10,40)
ax.set_xlim3d(10,40)
ax.set_zlim3d(0,4)
plt.show()
