title: Plot a 3D Boundary Decision in Python
body: <p>I'm trying to plot a 3D Decision Boundary, but it does not seem to be working the way it looks, see how it is:</p>
  
  <p><a href="https://i.stack.imgur.com/IqG8D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IqG8D.png" alt="enter image description here"></a></p>
  
  <p>I want it to appear as in this example here:</p>
  
  <p><a href="https://i.stack.imgur.com/wOvPH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wOvPH.png" alt="enter image description here"></a></p>
  
  <p>I do not know how to explain, but in the example above it literally looks like a "wall". And this is what I want to do in my code.</p>
  
  <p>Then follow my code:</p>
  
  <pre><code>fig = plt.figure()
  ax = fig.add_subplot(111, projection='3d')
  ax.set_title('Hello World')
  ax.set_xlim(-1, 1)
  ax.set_ylim(-1, 1)
  ax.set_zlim(-1, 1)
  ax.set_xlabel('X')
  ax.set_ylabel('Y')
  ax.set_zlabel('Z')
  
  w = [3,2,1]
  
  x = 1
  y = 1
  z = 1
  
  x_plan = (- w[1] * y - w[2] * z) / w[0]
  y_plan = (- w[0] * x - w[2] * z) / w[1]
  z_plan = (- w[0] * x - w[1] * y) / w[2]
  
  ax.plot3D([x_plan, 1, 1], [1, y_plan, 1], [1, 1, z_plan], "lightblue")
  
  plt.show()
  </code></pre>
  
  <p>P.S.: I'm using:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  </code></pre>
  
  <p>I believe that the problem should be in the calculation, or else in the:</p>
  
  <pre><code>ax.plot3D([x_plan, 1, 1], [1, y_plan, 1], [1, 1, z_plan], "lightblue")
  </code></pre>
  
  <p>P.S.2: I know that my Boundary Decision is not separating the data correctly, but at the moment this is a detail for me, later I will fix it.</p>