Skip to content

Commit 949bed6

Browse files
committed
demo
1 parent 01621be commit 949bed6

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

examples/api/power_norm_demo.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
#!/usr/bin/python
22

3-
from scipy.stats import norm
4-
from matplotlib import pyplot as pl
3+
from matplotlib import pyplot as plt
54
import matplotlib.colors as mcolors
65
import numpy as np
76
from numpy.random import multivariate_normal
87

9-
samples = np.vstack([ multivariate_normal([10,10], [[3,5],[4,2]], size=100000),
10-
multivariate_normal([30,20], [[2,3],[1,3]], size=1000)
8+
samples = np.vstack([multivariate_normal([10, 10], [[3, 5],[4, 2]], size=100000),
9+
multivariate_normal([30, 20], [[2, 3],[1, 3]], size=1000)
1110
])
1211

1312
gammas = [0.8, 0.5, 0.3]
14-
xgrid = np.floor((len(gammas)+1.)/2)
15-
ygrid = np.ceil((len(gammas)+1.)/2)
13+
xgrid = np.floor((len(gammas) + 1.) / 2)
14+
ygrid = np.ceil((len(gammas) + 1.) / 2)
1615

17-
pl.subplot(xgrid, ygrid, 1)
18-
pl.title('Linear normalization')
19-
pl.hist2d(samples[:,0], samples[:,1], bins=100)
16+
plt.subplot(xgrid, ygrid, 1)
17+
plt.title('Linear normalization')
18+
plt.hist2d(samples[:,0], samples[:,1], bins=100)
2019

21-
for i,gamma in enumerate(gammas):
22-
pl.subplot(xgrid, ygrid, i+2)
23-
pl.title('Power law normalization\n$(\gamma=%1.1f)$' % gamma)
24-
pl.hist2d(samples[:,0], samples[:,1], bins=100, norm=mcolors.PowerNorm(gamma))
20+
for i, gamma in enumerate(gammas):
21+
plt.subplot(xgrid, ygrid, i + 2)
22+
plt.title('Power law normalization\n$(\gamma=%1.1f)$' % gamma)
23+
plt.hist2d(samples[:, 0], samples[:, 1],
24+
bins=100, norm=mcolors.PowerNorm(gamma))
2525

26-
pl.subplots_adjust(hspace=0.39)
27-
pl.show()
26+
plt.subplots_adjust(hspace=0.39)
27+
plt.show()

0 commit comments

Comments
 (0)