Guest User

Untitled

a guest
May 25th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. #GENERATE 2 RANDOM GAUSSIAN DISTRIBUTION
  5. mu1, sigma1 = 0, 0.1
  6. s1 = np.random.normal(mu1, sigma1, 10000)
  7. mu2, sigma2 = 0, 0.3
  8. s2 = np.random.normal(mu2, sigma2, 10000)
  9.  
  10. #PLOT 2 RANDOM GAUSSIAN DISTRIBUTION
  11. plt.figure(1)
  12. plt.title('Histogram of a 2D-Gaussian Distribution')
  13. plt.xlabel('Radial position')
  14. plt.ylabel('Particle frequency')
  15. bins1 = plt.hist(s1, 100)
  16. bins2 = plt.hist(s2, 100)
  17. plt.show()
  18.  
  19. #GENERATE AND PLOT 2D RANDOM GAUSSIAN DISTRIBUTION
  20. plt.figure(2)
  21. plt.title('2D-Gaussian Distribution')
  22. bins = plt.hist2d(s1, s2, 100)
  23. cb = plt.colorbar()
  24. cb.set_label('counts in bin')
  25. #plt.axis('equal')
  26. plt.show()
Add Comment
Please, Sign In to add comment