Jul-14-2019, 10:07 AM
You need to be sure about points that forms a rectangle. Look at the simplest example below:
from mpl_toolkits.mplot3d import Axes3D import numpy as np from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='3d') rects = [[[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0 ], [0, 0, 0]]] # Each rectangle is presented as a set of points # array rects consist of rectangles ax.add_collection3d(Poly3DCollection(rects)) vv = np.array(rects) ax.scatter(vv[0][:, 0], vv[0][:, 1], vv[0][:, 2], color='r') plt.show()