Find and draw regression plane to a set of points
问题 I want to fit a plane to some data points and draw it. My current code is this: import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt points = [(1.1,2.1,8.1), (3.2,4.2,8.0), (5.3,1.3,8.2), (3.4,2.4,8.3), (1.5,4.5,8.0)] xs, ys, zs = zip(*points) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(xs, ys, zs) point = np.array([0.0, 0.0, 8.1]) normal = np.array([0.0, 0.0, 1.0]) d = -point.dot(normal) xx, yy = np.meshgrid([-5,10], [-5,10])