Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- #GENERATE 2 RANDOM GAUSSIAN DISTRIBUTION
- mu1, sigma1 = 0, 0.1
- s1 = np.random.normal(mu1, sigma1, 10000)
- mu2, sigma2 = 0, 0.3
- s2 = np.random.normal(mu2, sigma2, 10000)
- #PLOT 2 RANDOM GAUSSIAN DISTRIBUTION
- plt.figure(1)
- plt.title('Histogram of a 2D-Gaussian Distribution')
- plt.xlabel('Radial position')
- plt.ylabel('Particle frequency')
- bins1 = plt.hist(s1, 100)
- bins2 = plt.hist(s2, 100)
- plt.show()
- #GENERATE AND PLOT 2D RANDOM GAUSSIAN DISTRIBUTION
- plt.figure(2)
- plt.title('2D-Gaussian Distribution')
- bins = plt.hist2d(s1, s2, 100)
- cb = plt.colorbar()
- cb.set_label('counts in bin')
- #plt.axis('equal')
- plt.show()
Add Comment
Please, Sign In to add comment