|
14 | 14 | df: number of degree of freedom and must be >0
|
15 | 15 | size: scalar array ka shape
|
16 | 16 | '''
|
| 17 | + |
| 18 | +import numpy.random as r |
| 19 | +import matplotlib.pyplot as plt |
| 20 | +import seaborn as sns |
| 21 | + |
| 22 | +# chiVaraible = r.chisquare(df=2, size=(10,10)) |
| 23 | +# print('\nchiVaraible: \n',chiVaraible) |
| 24 | + |
| 25 | +# sns.distplot(chiVaraible, hist=False) |
| 26 | +# plt.show() |
| 27 | + |
| 28 | + |
| 29 | +# show advance example |
| 30 | +# pip install scipy |
| 31 | +# pip list |
| 32 | +from scipy import stats |
| 33 | +import numpy as np |
| 34 | + |
| 35 | +# np.linspace(star, end, randomNumber) |
| 36 | +numpyMatrix = np.linspace(0, 10, 100) |
| 37 | +# print('\nnumpyMatrix: ',numpyMatrix) |
| 38 | +fig, ax = plt.subplots(1, 1) |
| 39 | +print('\nfig: ',fig, ' \nax: ',ax) |
| 40 | + |
| 41 | +# 4 alag line ke liye dots |
| 42 | +linestypes = [':','--','-.','-'] |
| 43 | +deg_of_freedom = [1,4,7,6] |
| 44 | + |
| 45 | +# for loop ka use kare line styel aur deg of freemo ko marg karna hai aur ek final matrix bana hai. |
| 46 | +for df, ls in zip(deg_of_freedom, linestypes): |
| 47 | + ax.plot(numpyMatrix, stats.chi2.pdf(numpyMatrix, df), linestyle=ls) |
| 48 | + |
| 49 | +# x aur y axis ka range set kar rahe hain |
| 50 | +plt.xlim = (0, 10) |
| 51 | +plt.ylim(0, 0.4) |
| 52 | + |
| 53 | +# x aur y axis ka name aur output table ka name |
| 54 | +plt.xlabel('Values') |
| 55 | +plt.ylabel('Frequecy') |
| 56 | +plt.title('Chi_square Distribution') |
| 57 | + |
| 58 | +# show the graph |
| 59 | +plt.legend() |
| 60 | +plt.show() |
0 commit comments