title: Plot 3D Cube and Draw Line on 3D in Python
body: <p>I know, for those who know Python well piece of cake a question.</p>
  <p>I have an excel file and it looks like this:</p>
  <p>1   7   5   8   2   4   6   3</p>
  <p>1   7   4   6   8   2   5   3</p>
  <p>6   1   5   2   8   3   7   4</p>
  <p>My purpose is to draw a cube in Python and draw a line according to the order of these numbers.
  Note: There is no number greater than 8 in arrays.</p>
  <p><strong>I can explain better with a pictures.</strong></p>
  <p><a href="https://i.stack.imgur.com/Sj54P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sj54P.png" alt="enter image description here" /></a></p>
  <p><strong>First Step:</strong></p>
  <p><a href="https://i.stack.imgur.com/Y6vGK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y6vGK.png" alt="enter image description here" /></a></p>
  <p><strong>Second Step</strong></p>
  <p><a href="https://i.stack.imgur.com/VZLQH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VZLQH.png" alt="enter image description here" /></a></p>
  <p>Last Step:</p>
  <p><a href="https://i.stack.imgur.com/cUCjM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cUCjM.png" alt="enter image description here" /></a></p>
  <p><strong>I need to print the final version of the 3D cube for each row in Excel</strong>.</p>
  <p><strong>My way to solution</strong></p>
  <pre><code>import numpy as np 
  import numpy as np
  from mpl_toolkits.mplot3d import Axes3D
  from mpl_toolkits.mplot3d.art3d import Poly3DCollection, Line3DCollection
  import matplotlib.pyplot as plt
   
  df = pd.read_csv(&quot;uniquesolutions.csv&quot;,header=None,sep='\t')
  myArray = df.values
  
  points = solutionsarray
  
  def connectpoints(x,y,p1,p2):
     x1, x2 = x[p1], x[p2]
     y1, y2 = y[p1], y[p2]
     plt.plot([x1,x2],[y1,y2],'k-')
  
   # cube[0][0][0] = 1
   # cube[0][0][1] = 2
   # cube[0][1][0] = 3
   # cube[0][1][1] = 4
   # cube[1][0][0] = 5
   # cube[1][0][1] = 6
   # cube[1][1][0] = 7
   # cube[1][1][1] = 8
  
   for i in range():
       connectpoints(cube[i][i][i],cube[],points[i],points[i+1]) # Confused!
  
  
  
   ax = fig.add_subplot(111, projection='3d')
   # plot sides
  
   ax.add_collection3d(Poly3DCollection(verts, 
       facecolors='cyan', linewidths=1, edgecolors='r', alpha=.25))
  
  ax.set_xlabel('X')
  ax.set_ylabel('Y')
  ax.set_zlabel('Z')
  
  plt.show()
  </code></pre>
  <p>In the question <a href="https://stackoverflow.com/questions/44881885/python-draw-parallelepiped">here</a>, they managed to draw something with the points given inside the cube.</p>
  <p>I tried to use <a href="https://stackoverflow.com/questions/35363444/plotting-lines-connecting-points">this 2D connection function.</a></p>
  <p><strong><strong>Last Question:</strong> Can I print the result of red lines in 3D? How can I do this in Python?</strong></p>