0

Right now I have a scatter 3D plot and all three variables x, y, z are independent variables. I want to fit a surface plane to see roughly which point is an outlier, not on the plane.

My script looks like this:

from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import pylab
from matplotlib import cm


x_axis = np.array([-1.0421, 0.628354, 8.79899, 0.359502, -0.952719, -0.54148, 
          0.604585, 0.739086, 8.62336, 6.29254, 1.3942, 3.82348, -0.214241, 
          4.86446, 2.56733, 2.97113, -0.395414, 0.848251])


y_axis=np.array([-1131.02, -1111.02, -1076.85, -1125.94, -1140.41, -1130.37, -1114.58,
        -1148.05, -1103.2, -1109.89, -1131.98, -1114.59, -1093.26, -1108.23,
        -1121.88, -1111.72, -1143.87, -1126.38])

z_axis =np.array([0.76, 0.75, 0.12, 1.07, 1.06, 0.63, 0.14, 0.79, 0.16, 0.14, 0.81, 0.36, 0.09,
        0.26, 0.51, 0.28, 0.92, 0.66])

fig = plt.figure(num=None, figsize=(9, 7), facecolor='w', edgecolor='k')  
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x_axis, y_axis, z_axis, c='brown', marker='o', s=25)
plt.show()

My plot looks like this: enter image description here

My whole takeaway is just to see how many outliers there are and how "good" the points can form a surface. If there are only 2 or 3 outliners, I can tell x, y, z have a strong correlation. My point is just to see if three of them form a correlation.

JY078
  • 393
  • 9
  • 21

0 Answers0