matplotlib - Contour plots in Python -


in following lines calculating quantity "chisquare" function of 2 variables, , s :

def getchi(pa, ps_theory, fab_matrix):     chisquare = linalg.transpose(pa-ps_theory).dot(fab_matrix).dot(pa-ps_theory)     return chisquare  n = 64 sigma = 3. key = np.arange(n, dtype=float) sigma_hat = (float(n)/(2.*np.pi*sigma)) a_list = np.arange(0.1, 0.7, 0.01)  in a_list:     s in np.arange(sigma_hat-3.5, sigma_hat+3.5, 0.01):         ps_theory = a*np.exp(-(key*key/(2.*s*s)))         chi_square[a,s] = getchi(pa, ps_theory, fab_matrix) 

now need plot contour plots of chisquare, after subtracting minimum. tried in following way:

fig = plt.figure()         ax = figura.add_subplot(111)         ax.set_title('contour_plots_chi_square{}'.format(n))         ax.set_xlabel('a')         ax.set_ylabel('sigma')         plt.contour(a_list, np.arange(sigma_hat-3.5, sigma_hat+3.5, 0.01), chi_square)         plt.savefig('chi_square_contour_plot/chi_square_contour_plot{}.svg'.format(n)) 

but not work, because seems that:

plt.contour(a_list, np.arange(sigma_hat-3.5, sigma_hat+3.5, 0.01), chi_square) 

does not follow correct syntax. explain correct syntax?


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -