Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 18fb208

Browse files
committed
fixed bug in bivariate normal
svn path=/trunk/matplotlib/; revision=2554
1 parent 47d90a5 commit 18fb208

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/matplotlib/_pylab_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def get_fig_manager(num):
1414
get_fig_manager = staticmethod(get_fig_manager)
1515

1616
def destroy(num):
17+
1718
if not Gcf.has_fignum(num): return
1819
figManager = Gcf.figs[num]
1920

lib/matplotlib/mlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,8 @@ def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
960960
Ymu = Y-muy
961961

962962
rho = sigmaxy/(sigmax*sigmay)
963-
z = Xmu**2/sigmax**2 + Ymu**2/sigmay - 2*rho*Xmu*Ymu/(sigmax*sigmay)
964-
return 1.0/(2*pi*sigmax*sigmay*(1-rho**2)) * exp( -z/(2*(1-rho**2)))
963+
z = Xmu**2/sigmax**2 + Ymu**2/sigmay**2 - 2*rho*Xmu*Ymu/(sigmax*sigmay)
964+
return 1.0/(2*pi*sigmax*sigmay*numerix.mlab.sqrt(1-rho**2)) * exp( -z/(2*(1-rho**2)))
965965

966966

967967

0 commit comments

Comments
 (0)