def plot_points(points, show=True):
import matplotlib.pyplot as plt
points = np.asanyarray(points)
dimension = points.shape[1]
if dimension == 3:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(*points.T)
elif dimension == 2:
plt.scatter(*points.T)
else:
raise ValueError('Points must be 2D or 3D, not %dD', dimension)
if show:
plt.show()
评论列表
文章目录