Jeremiah_

hist3d

Nov 22nd, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. from mpl_toolkits.mplot3d import Axes3D
  3.  
  4. #%% pdf estimation 3d
  5. # X1
  6. fig = plt.figure(figsize=(10,10))
  7. ax = fig.add_subplot(111, projection='3d')
  8. hist, xedges, yedges = np.histogram2d(X1[:, 45], X1[:,120], density=True)
  9.  
  10. xpos, ypos = np.meshgrid(xedges[:-1], yedges[:-1], indexing="ij")
  11. xpos = xpos.ravel()
  12. ypos = ypos.ravel()
  13. zpos = 0
  14.  
  15. dx = np.ones_like(zpos)
  16. dy = np.ones_like(zpos)
  17. dz = hist.ravel()
  18.  
  19. ax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort='average')
  20. plt.title('pdf estimation of X1')
  21. #plt.savefig('/media/jeremiah/7E9BF5A34D96B6A4/2019.4/Processos Estocasticos/Trabalho 2/pdf_estimation_X1_3d.png')
  22. plt.show()
  23.  
  24. #--------------------------------------------------------------------------------
  25.  
  26. # X2
  27. fig = plt.figure(figsize=(10,10))
  28. ax = fig.add_subplot(111, projection='3d')
  29. hist, xedges, yedges = np.histogram2d(X2[:, 45], X2[:,120], density=True)
  30.  
  31. xpos, ypos = np.meshgrid(xedges[:-1], yedges[:-1], indexing="ij")
  32. xpos = xpos.ravel()
  33. ypos = ypos.ravel()
  34. zpos = 0
  35.  
  36. dx = np.ones_like(zpos)
  37. dy = np.ones_like(zpos)
  38. dz = hist.ravel()
  39.  
  40. ax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort='average')
  41. plt.title('psf estimation of X2')
  42. #plt.savefig('/media/jeremiah/7E9BF5A34D96B6A4/2019.4/Processos Estocasticos/Trabalho 2/pdf_estimation_X2_3d.png')
  43. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment