#NEWLINE# @ staticmethod #NEWLINE# def contour_plot_density( distribution , Xs = None , Ys = None , log_domain = False ) : #NEWLINE# #INDENT# '\n        Contour-plots a 2D density. If Gaussian, plots 1.96 interval contour only\n        \n        density - distribution instance to plot\n        Xs - x values the density is evaluated at\n        Ys - y values the density is evaluated at\n        log_domain - if False, density will be put into exponential function\n        ' #NEWLINE# if ( isinstance ( distribution , Gaussian ) and ( log_domain == False ) ) : #NEWLINE# #INDENT# gca ( ) . add_artist ( Visualise . get_gaussian_ellipse_artist ( distribution ) ) #NEWLINE# gca ( ) . plot ( distribution . mu [ 0 ] , distribution . mu [ 1 ] , 'r*' , markersize = 3.0 , markeredgewidth = 0.1 ) #NEWLINE# return #NEWLINE# #UNINDENT# assert ( distribution . dimension == 2 ) #NEWLINE# if ( Xs is None ) : #NEWLINE# #INDENT# ( ( xmin , xmax ) , _ ) = distribution . get_plotting_bounds ( ) #NEWLINE# Xs = linspace ( xmin , xmax ) #NEWLINE# #UNINDENT# if ( Ys is None ) : #NEWLINE# #INDENT# ( _ , ( ymin , ymax ) ) = distribution . get_plotting_bounds ( ) #NEWLINE# Ys = linspace ( ymin , ymax ) #NEWLINE# #UNINDENT# D = zeros ( ( len ( Ys ) , len ( Xs ) ) ) #NEWLINE# for i in range ( len ( Xs ) ) : #NEWLINE# #INDENT# for j in range ( len ( Ys ) ) : #NEWLINE# #INDENT# x = array ( [ [ Xs [ i ] , Ys [ j ] ] ] ) #NEWLINE# D [ ( j , i ) ] = distribution . log_pdf ( x ) #NEWLINE# #UNINDENT# #UNINDENT# if ( log_domain == False ) : #NEWLINE# #INDENT# D = exp ( D ) #NEWLINE# #UNINDENT# contour ( Xs , Ys , D , origin = 'lower' )