I am trying to calculate first of all, the plane that fits a group of points in 3 dimensions, this I have done with the following code:
import numpy as np
import scipy.linalg
# Create some 3-dim points
mean = np.array([0.0,0.0,0.0])
cov = np.array([[1.0,-0.5,0.8], [-0.5,1.1,0.0], [0.8,0.0,1.0]])
data = np.random.multivariate_normal(mean, cov, 50)
#Fit plane
C,_,_,_ = scipy.linalg.lstsq(np.c_[data[:,0], data[:,1], np.ones(data.shape[0])], data[:,2])
# Coefficients in the form: a*x + b*y + c*z + d = 0.
a, b, c, d = C[0], C[1], -1., C[2]
But once I have the coefficients of the plane, how can I know the angle that the plane makes with the vertical? Thanks!