Building two-dimensional Gaussian distributions in matplotlib

How can we build (in python matplotlib) two-dimensional Gaussian distributions, given their centers and covariance matrices as numpy arrays?

Let's say that our options are as follows:

center1=np.array([3,3]) center2=np.array([5,5]) cov1=np.array([ [1.,.5], [.5,.1]]) cov2=np.array([ [.2,.5], [.5,.2]]) 
+7
source share
2 answers
+5
source

For future reference, there is a matplotlib.mlab function called bivariate_normal , which should do what you want, you can see a visual example in the gallery.

+3
source

All Articles