title: Why can't I get the any 3D plots output with NumPy?
body: <p>I am unable to get the output I expect, but there is no error either. Can you help me understanding why?</p>
  <p>I am new to numpy so I have very little idea.</p>
  <pre><code># import libraries
  import matplotlib.pyplot as plt
  import numpy as np                       
  
  
  
  # initialising arrays
  n=100
  r1=np.linspace(0,2,n)                    
  r2=np.linspace(0,2,n)
  p1=np.linspace(0,1,n)
  time_avg=np.empty(shape=(0,n**2))
  exp_avg=np.empty(shape=(0,n**2))
  fig=plt.figure()
  ax1=fig.add_subplot(111,projection='3d')
  
  #calculating two things-time avgerage and expected average,plot accordingly
  for i in range(0,n):
      for j in range(0,n):
          for k in range(0,n):
              t=np.sqrt(r1[i]*r2[j])
              time_avg=np.append(time_avg,t)               
              e=(r1[i]*p1[k]+r2[j]*(1-p1[k]))               
              exp_avg=np.append(exp_avg,e)
              #conditions for plotting
              if time_avg[-1]==exp_avg[-1]:                      
                  ax1.scatter(r1[i],r2[j],p1[k],color='k',marker='o')
              if time_avg[-1]&gt;exp_avg[-1]:
                  ax1.scatter(r1[i],r2[j],p1[k],color='r',marker='o')
              if time_avg[-1]&lt;exp_avg[-1]:
                  ax1.scatter(r1[i],r2[j],p1[k],color='b',marker='o')
  #plotting 
  ax1.set_xlabel('r1')
  ax1.set_ylabel('r2')
  ax1.set_label('p1')
  plt.show()
  </code></pre>